Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lua Script - run again [duplicate]

Tags:

c++

c

lua

I have Lua embeded in my C/C++ app. If I run script with

lua_pcall( luaState, 0, LUA_MULTRET, 0 );

for the first time, all is OK (return 0). But I need to run script again after some time. Calling same function again, script is not executed and retun value is 2. How can I run it again without reload everything again from file ?

like image 961
Martin Perry Avatar asked Apr 21 '26 17:04

Martin Perry


1 Answers

Push it twice on the stack or store it as a global variable.

like image 82
W.B. Avatar answered Apr 23 '26 08:04

W.B.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!