xLua icon indicating copy to clipboard operation
xLua copied to clipboard

Example "12_ReImplementInLua" fails with "invalid c# struct!" (again?)

Open noncom opened this issue 2 years ago • 0 comments

Running the example from https://github.com/Tencent/xLua/tree/master/Assets/XLua/Examples/12_ReImplementInLua fails with the following error:

LuaException: [string "chunk"]:37: invalid c# struct!
stack traceback:
	[C]: in field '?'
	[string "chunk"]:37: in metamethod '__newindex'
	[string "chunk"]:4: in function 'test_vector3'
	[string "chunk"]:47: in main chunk
XLua.LuaEnv.ThrowExceptionFromError (System.Int32 oldTop) (at Assets/XLua/Src/LuaEnv.cs:441)
XLua.LuaEnv.DoString (System.Byte[] chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:274)
XLua.LuaEnv.DoString (System.String chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:288)
TestXLua.Start () (at Assets/Scripts/TestXLua.cs:34)

The problematic code is fields_setters[k](o, v), but I've tried adding just print(o) before that, and it fails with the same error. It looks like working with o itself causes this trouble. The only function that worked with o was print(type(o)) which printed userdata.

I saw that recently there was a fix for a similar symptom, #951, but it looks like that this time the problem is different. I'm using the xLua-2.1.16_with_silicon_support version.

noncom avatar Nov 18 '22 14:11 noncom