You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do not know how to use the function KeraLua.Lua.NewUserData() correctly. I get a valid IntPtr object from it but do not know how to dereference it to a structure. The following code is a stripped-down snippet which causes a System.ExecutionEngineException at:
Fatal error. Internal CLR error. (0x80131506)
at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr, IntPtr, IntPtr, Int32)
at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr, System.Object, Boolean)
at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr, System.Type)
at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr, System.Type)
at NLuaExperiments.KeraLuaTest.Start()
at NLuaExperiments.Program.Main(System.String[])
using NLua;using System;using System.Runtime.InteropServices;namespaceNLuaExperiments{publicstructUserData{publicobjectRef;}publicclassKeraLuaTest{privateLualua;publicKeraLuaTest(Lualua){this.lua =lua;}publicvoidStart(){
KeraLua.Lua state= lua.State;IntPtrp= state.NewUserData(Marshal.SizeOf(default(UserData)));UserDatau=(UserData)Marshal.PtrToStructure(p,typeof(UserData));}}classProgram{privatestaticLualua=new();staticvoidMain(string[]args){new KeraLuaTest(lua).Start();}}}
Does NewUserData() does not provide a valid memory pointer to use as structure?
The text was updated successfully, but these errors were encountered:
Hello,
I do not know how to use the function KeraLua.Lua.NewUserData() correctly. I get a valid IntPtr object from it but do not know how to dereference it to a structure. The following code is a stripped-down snippet which causes a System.ExecutionEngineException at:
Does NewUserData() does not provide a valid memory pointer to use as structure?
The text was updated successfully, but these errors were encountered: