lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,
   I am facing a problem related to
http://lua-users.org/wiki/ClassesAndMethods

In that it is indicated that if u want to escape
infintie looping to find a method which is not defined,
u should use rawget.

I presume you should use rawset before using rawget.
(as rawget alone does not work).

so when i use rawset for example a method:-

function A:new(x,y)  -- create an instance of class A
  local t = {x=x,y=y}
  settag(t,tag(A))  -- tag the new table to tell it what its class type is
  return t
end

like this

rawset(A,new,A:new) it does not work, but gives me an error.

Can anybody shed some light on this?

Thanks
Gaurav