qlua / luainterface

Automatically exported from code.google.com/p/luainterface
0 stars 0 forks source link

2.0.3 doesn't support oo call like this "lua.GetFunction("table:method").Call()" #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
   define a table in lua like this:
   test={ v=1 }
   function test:Do()
     return self.v
   end
2.
   in c#:
   lua.GetFunction("test.Do").Call();
   throw a exception:"attempt to index local 'self' (a nil value)"

   if we get a luaFunction like this"lua.GetFunction("test:Do")",will
return null.

off course ,there's a way we can get the correct result.it's follow as:
 in lua:
   test={ v=1 }
   function test.Do(self)
     return self.v
   end

  in C#:
   lua.GetFunction("test.Do").Call(lua.GetTable("test"));

 it does work.

 but,as we know ,it's too expensive.

Original issue reported on code.google.com by isSin...@gmail.com on 22 Dec 2009 at 7:53

GoogleCodeExporter commented 9 years ago
if you use function test:Do()

Cant you just call it using:

lua.GetFunction("test.Do").Call(lua.GetTable("test"));

 as well?

that will result in a call like test.Do(test) this IS what lua does internally 
if you do test:Do() !!

Original comment by tim@mylemans.com on 3 Jan 2011 at 1:11

GoogleCodeExporter commented 9 years ago
uh,sorry for close this issue。it has been stay here almost 1 year。thx。

PLEASE CLOSE THIS ISSUE。

Original comment by isSin...@gmail.com on 5 Jan 2011 at 2:03

GoogleCodeExporter commented 9 years ago

Original comment by capre...@gmail.com on 8 Aug 2011 at 8:24