stop and wait on luaalchemy

32 views
Skip to first unread message

sillybear

unread,
Jan 26, 2012, 5:50:59 PM1/26/12
to lua-alchemy-dev
Hi Group,

how can I implement "stop and wait" function during the lua script
execution in actionscript. For example, in lua script, I want to show
an Actionscript dialog box, and based on user's selection (Yes/No) to
continue the next step of lua script, but I do not know how to
implement this with lua-alchemy.

Thanks

Bobby Parker

unread,
Jan 26, 2012, 5:51:49 PM1/26/12
to lua-alc...@googlegroups.com
You can use coroutines to do this.

Check my last submission to the group, it covers that scenario.

sillybear

unread,
Jan 26, 2012, 9:15:25 PM1/26/12
to lua-alchemy-dev
Thank Bobby for you quick reply. As I am very new to this group, could
you point me to the right link for your last submission? I only find
the April 17 2011 submission. Is that the right one?

Thanks

On Jan 26, 5:51 pm, Bobby Parker <sh0rtw...@gmail.com> wrote:
> You can use coroutines to do this.
>
> Check my last submission to the group, it covers that scenario.
>
> On Thu, Jan 26, 2012 at 5:50 PM, sillybear <jxyi...@yahoo.ca> wrote:
> > Hi Group,
>
> > how can I implement "stop and wait" function during the lua script
> > execution in actionscript. For example, in lua script, I want to show
> > an Actionscript dialog box, and based on user's selection (Yes/No) to
> > continue the next step of lua script, but I do not know how to
> > implement this with lua-alchemy.
>
> > Thanks
>
> --
> Bobby Parker
> sh0rtw...@gmail.comhttp://www.stormwind-studios.com

Bobby Parker

unread,
Jan 27, 2012, 10:45:49 AM1/27/12
to lua-alc...@googlegroups.com
Hiya,

Find enclosed two files, one of them a Flex project file, and the other a zip file containing example code for working with lua. The main body of the project is in Main.mxml and has some support for some nifty things, among them, coroutines for yielding/resuming across the As3/Lua boundary. It essentially uses an event handler in Lua that resumes scripts based on some task identifier (which is passed out of the script when it calls a function). There's also some metatable examples.

The best thing to check out would be the "askYesOrNo" function  in runtime_assets/Scripts/libLua.lua and the associated promptSample.lua file which references it, which will show you how to yield script execution until an answer is receieved from an *AS3* dialog window.

There's also a nifty dialog system that can autogenerate components based on arguments that you provide in a basic object format. Pay special attention to type casting, it can and will bite you.

Hope this helps.

Bobby
LuaAlchemyPortSrc.zip
Lua-AlchemyPort.fxp

Yi Liu

unread,
Apr 25, 2012, 7:34:11 AM4/25/12
to lua-alc...@googlegroups.com
Hi Bobby,

I tried with your examples, it works but does not fit our
requirements. We want something like lua.setGlobal("client",
clientObject); while in clientObject class has a actionscript
"askyesorno" function which can stop and wait there.

Please help.

> sh0rtw...@gmail.comhttp://www.stormwind-studios.com
>
>  LuaAlchemyPortSrc.zip
> 574KViewDownload
>
>  Lua-AlchemyPort.fxp
> 1064KViewDownload

MMiller

unread,
Apr 26, 2012, 9:45:38 AM4/26/12
to lua-alchemy-dev
Hi Bobby,

Our product allows our clients to modify the internal workings using
lua. We'll use the askwait example that you've given. We have a
script available to them

client.alert("HELLO") similar to the ask wait. We have many clients
out there who have scripts just like this. We can't really rewrite it
to just

alert("HELLO")

which then calls client.alert(taskID, "HELLO") since those scripts
already exist in the market. How can I override it so the script
client.alert("HELLO") is still written in this form but calls
client.alert(taskID, "HELLO")

Worse still the client has been set as a global in our system. We
have internal objects that need this feature. For instance the
following psuedo script.

myapp = clientevent.apps["MyApp"]
datasynch = myapp.synchrules["myrule"]
datasynch.synch() <-- should pause until the synch is
done
client.alert("SYNCH HAS COMPLETED") <-- should pause until the user
hits ok

Something like the above is already in the market in our J2ME
applications.

How do I override a local "datasynch" to call the synch() function on
it with a taskID?

Thanks for all your help so far. Hopefully you can sort us out.
Reply all
Reply to author
Forward
0 new messages