lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

lua_load is a very generic function to
load code (you execute it afterwards
with lua_call or lua_pcall). Try
luaL_loadfile and luaL_loadbuffer.
But, if you prefer, lua_dostring still
exists, it is declared in lauxlib.h
(lauxlib.pas, for Delphi).
Trying with "luaL_loadbuffer", the result is always "Error! ...".
...
 st := 'print("Hello Lua!")';
 k := luaL_loadbuffer(L,PChar(st), sizeof(st), '');
 if k <> 0 then
   ShowMessage('Error! Lua interpreter failed');
...

Trying with "luaL_loadfile", the result is always the same "Error! ...".
...
 st := 'print("Hello Lua!")';
 k := luaL_loadbuffer(L,PChar(st));
 if k <> 0 then
   ShowMessage('Error! Lua interpreter failed');
...

What am I missing with paramaters?
Thanks!

jilani