Recent

Author Topic: luajit access violation  (Read 370 times)

mercury

  • Full Member
  • ***
  • Posts: 154
luajit access violation
« on: February 01, 2020, 11:00:36 am »
Hi there,

I am trying to integrate luajit to my program.

Basic lua function works fine.

Then I wanna let lua code interact with pascal code.

And strange things happen, I can't even debug it.

Any ideas are appreciated.

unit1.pas
Code: Pascal  [Select][+][-]
  1.   P := luaL_newstate();
  2.  
  3.   luaL_openlibs(P);
  4.   LoadLuaLCL(P); // <-- access violation
  5.  
  6.   lua_pushstring(P, 'v1.00001');
  7.   lua_setglobal(P, 'Version');

procedure LoadLuaLCL(L: Plua_State);
Code: Pascal  [Select][+][-]
  1.   luaL_openlib(L, 'lcl', @Lib, 0);
  2.  
  3.   lua_settable(L, -3);
  4.   lua_pushliteral(L, 'Version');
  5.   lua_pushliteral(L, '1.00000');
  6.   lua_settable(L, -3);
  7.  
  8.   lua_setglobal(L, 'lcl');
« Last Edit: February 08, 2020, 08:30:12 am by mercury »

 

TinyPortal © 2005-2018