-
Lua Help
I am just starting with the Lua Object. So I found the example in The Daily Click of how to use Lua script and MMF2. But I cannot seem to get it to work.
I created a test app with one frame. Added the Lua Object. In script I added:
function damage (attack, defense)
dam = attack - defense
return dam
end
I then call the function damage passing in "20|2"
So I should get back 18
I then tell it to set a text of the text box to the
returned string of function damage.
But don't get anything. I can tell it to get the return count and it is 1.
What am I doing work???
At Start of Frame
-
Re: Lua Help
Found the problem. The index for the return string is 0 based. I had is set to 1 assumning that if you say return 1 it would be 1 based also to match the call on return.
-
Re: Lua Help
In the help I see there is "run file" and "run script".
I assume this means that in "run file" the Lua script is store external to MMF2 .exe whereas with "run script" the Lua script is stored within the MMF2 .exe. Is this correct???
Can you have more than one Lua object. For example, lets say I want to break my Lua functions up into groups. Like a data access group or a display group. Can I have a Lua Object-Data Access Functions and a Lua Object-Display Funtions???
-
Re: Lua Help
Hi,
Please stop right here and use the XLua extension which is superior to the Lua Object in every way.
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=226974&Searchpa ge=2&Main=18449&Words=xlua&Search=true#Post226974
-
Re: Lua Help
Yes I just found that. But no help file and the website if you click on it you get access not allowed.
So is this a fully supported Lua Object by Clickteam and is there a cost of use it in an application???
-
Re: Lua Help
Just checked the hard drive and found the help file. Does not seem to work from with MMF however.
-
Re: Lua Help
Strange, XLua should work fine :O
It is the only object still in development, the other extensions have no developer support at all anymore. There's no cost and it has a lot of features that the other objects lack ;)
-
Re: Lua Help
I am using MMF2 Developer Ver2Build R251 on Windows 7. I installed the XLua extension from the ExtensionView program which worked fine.
I create a new app and add XLua to the frame. I then click on HELP but no help pops up. I click on the website and I get
Forbidden
You don't have permission to access /xlua/ on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I then manually go to the help folder in the Program Files area and I find the help file. I am able to run help from there but not within MMF2.
-
Re: Lua Help
Oh, sorry, I thought the extension itself doesn't work. Not sure about the help file :) There also is an online documentation somewhere but I have no clue where.
-
Re: Lua Help
I found some at http://www.taloncrossing.com/xlua/docs/
-
Re: Lua Help
Everything listed at http://www.fusionwiki.com/wiki/XLua should be correct and up to date.
XLua ships with a help file and several example MFAs. However if you downloaded it via a third party extension manager, I cannot guarantee that those resources are getting passed along.