I need to integrate some runtime scripting in a service to allow for custom alerts to be provided.
Has anyone integrated Lua or other for runtime scripting?
I searched the forums for Lua but there was not one hit....
any one integrate Lua or other runtime scripting?
Re: any one integrate Lua or other runtime scripting?
Gave the lua52 example a try... it seems to crash for me...
Using a simple script: (test.lua) works fine in the lua interpreter.
However, using the example for the lua52 pb download, modified slightly, crashes.
The use of os.execute() w/in the pb lib stuff is where it fails...
any idea what I'm doing wrong?
Using a simple script: (test.lua) works fine in the lua interpreter.
Code: Select all
function test()
os.execute("C:\\windows\\system32\\notepad.exe")
end
test()
The use of os.execute() w/in the pb lib stuff is where it fails...
any idea what I'm doing wrong?
Code: Select all
IncludeFile (#PB_Compiler_Home + "include\lua.pbi")
Global lua_state = lua_open() ; lua init
OpenConsole()
If lua_state
luaopen_base(lua_state) ; base lib laden , fuer print usw
luaString.s = "function test()" + #LF$ ; test function
luaString + " os.execute("+#DQUOTE$+"c:\\windows\\system32\\notepad.exe"+#DQUOTE$+")" + #LF$
luaString + " print(123456780)" + #LF$
luaString + " return 666,777" + #LF$
luaString + "end" + #LF$
MessageRequester("test",luaString)
luaL_loadstring(lua_state, luaString) ; script laden
lua_pcall(lua_state, 0, 0, 0) ; script starten
lua_getglobal(lua_state, "test") ; functionsname auf den stack packen
lua_call(lua_state, 0, 2) ; function, die auf dem stack, aufrufe, mit 2 rueckgabe werten
Debug lua_tointeger(lua_state, -1) ; -1 erster parameter
Debug lua_tointeger(lua_state, -2) ; -2 zweiter parameter
lua_pop(lua_state, 1) ; stack saeubern
EndIf
Input()
CloseConsole()
