[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: SetTagMethod
- From: "Denis Lamarche" <brainwav@...>
- Date: Wed, 10 Oct 2001 05:15:41 +0000
Hi, I am trying to make a table in which I can store information in but also
use it to access other information in C. This is what I am trying to do:
(lua 4.0)
[LUA]
function setanim (receiver, parameter, operator)
if type(receiver) == "table" then
--Set_Animation_parameter sets 'C' variables
return Set_Animation_Parameter(parameter, operator)
else
return Old_SetTag(receiver, parameter, operator)
end
end
function getanim (receiver, parameter, operator)
if type(receiver) == "table" and parameter ~= "index" and parameter ~=
"name" then
--Get_Animation_Parameter() just returns a number from 'C'
return Get_Animation_Parameter(parameter)
else
if parameter=="index" then
return receiver.index
end
if parameter=="name" then
return receiver.name
end
end
end
dis=newtag()
Old_GetTag=settagmethod(dis, "gettable", getanim)
Old_SetTag=settagmethod(dis, "settable", setanim)
function Load_Animation(fname)
temp={}
temp.index, temp.name=Lua_Load_Animation(fname) --A registered 'C'
function
return temp
end
A1_door=Load_Animation("door.dat")
print("Name: -"..A1_door.name.."- Index: "..A1_door.index)
[End LUA]
for some reason Old_GetTag and Old_SetTag are nil, but I know that the tags
are being set. im getanim im trying to return receiver.name if the
parameter=="name", but this ends up calling getanim again and I guess it
ends up in a recursive loop and the stack overflows. What am I doing wrong?
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp