How to re-execute a lua scripte

117 views
Skip to first unread message

Wendi Su

unread,
Jun 1, 2012, 4:58:20 AM6/1/12
to ipho...@googlegroups.com
I am currently working on a project which needs to use lua as a scripting language. And the lua scripts should be executed every second.
But here is the problem.
If I don't use wax_end, the same script will be execute only once.
And if I use wax_end, all the previous data in lua will be cleared, which means it reloads data every time it is executed. And that takes too much time.

What should I do to solve this problem.

wangoc...@gmail.com

unread,
Nov 4, 2013, 10:12:31 PM11/4/13
to ipho...@googlegroups.com
Hello, recently I have encountered this problem.Can you tell me  how to solve it, thank you very much.

在 2012年6月1日星期五UTC+8下午4时58分20秒,Wendi Su写道:

wangoc...@gmail.com

unread,
Nov 4, 2013, 10:12:53 PM11/4/13
to ipho...@googlegroups.com
Hello, recently I have encountered this problem.Can you tell me  how to solve it, thank you very much.

在 2012年6月1日星期五UTC+8下午4时58分20秒,Wendi Su写道:
I am currently working on a project which needs to use lua as a scripting language. And the lua scripts should be executed every second.

smith

unread,
Nov 23, 2016, 11:49:02 AM11/23/16
to iPhone Wax
Lua first compiles the code into an intermediate format (bytecode). Compiling is a step which takes quite some time, so you want to do this once. So the best idea is to store this compiled code and and run it as needed. think the functions to compile are lua_loadfile. I have done it and it works very well. Try to adapt the answer below.

Reply all
Reply to author
Forward
0 new messages