qlua / luainterface

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

Error calling .net method with string argument, after calling with null string #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call a .NET method with null string argument, e.g. DoSomething(null)
2. Call the same .NET method with non-null argument, e.g. DoSomething("good")

What is the expected output? What do you see instead?
Exception "argument number 1 is invalid" is thrown.

Please provide any additional information below.

Did some code inspection and found:
1. LuaMethodWrapper.call(IntPtr luaState) calls 
_LastCalledMethod.argTypes[i].extractValue(...) which returns null even when 
the parameter is non-null string (i.e. "good").
2. CheckType.checkType(IntPtr luaState, int stackPos, Type paramType) returns 
extractNetObject when paramType is string and luatype is LUA_TNIL.

Should checkType return getAsString instead?

Original issue reported on code.google.com by jcw...@gmail.com on 3 Nov 2011 at 10:25

GoogleCodeExporter commented 9 years ago
Yes, it sounds like a method caching problem.

Original comment by steve.j....@gmail.com on 10 Jul 2012 at 1:05