test.lua
--------------------------------------------------------------------------------------------------------
function Main()
local var1 = 123
end
--------------------------------------------------------------------------------------------------------
Script execution
Under FB debugging or after the DLL is generated, the execution is normal
--------------------------------------------------------------------------------------------------------
test.lua
--------------------------------------------------------------------------------------------------------
function Main()
local var1 = 123.123
end
--------------------------------------------------------------------------------------------------------
After adding decimals, it is normal under FB debugging
Generating DLL execution will cause the process to disappear
What went wrong is
The luaL_loadfile function
FB :
--------------------------------------------------------------------------------------------------------
sub Test()
Dim As lua_State Ptr L
L = luaL_newstate()
luaL_openlibs(L)
OutputDebugString("[DBG]Path:" + ExePath())
If (luaL_loadfile(L, ExePath() + "\test.lua") <> 0 ) Then
OutputDebugString("[DBG]LuaErr1:" + *lua_tostring(L,-1))
Return
Else
lua_pcall(L,0,0,0)
lua_pop(L,-1)
lua_getglobal(L,"Main")
If lua_pcall(L,0,0,0) <> 0 Then
OutputDebugString("[DBG]LuaErr2:" + *lua_tostring(L,-1))
EndIf
lua_pop(L,-1)
lua_close( L )
Endif
end