The Daily Click ::. Forums ::. Klik Coding Help ::. Questions about lua!
 

Post Reply  Post Oekaki 
 

Posted By Message

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
4th November, 2009 at 13:19:49 -



IT WORKS IT WORKS!

Whoo hoo!

The only command that isn't working now is the one that moves the screen. It's really odd because everything is setup correctly as far as I can tell.

http://www.jsoftgames.com/luayeildingXlua.zip

 
n/a

Xgoff



Registered
  22/02/2009
Points
  135
4th November, 2009 at 15:53:35 -

the 's' in the 'On Function "movescreen"' event isn't capitalized, which is why it isn't working

 
Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
5th November, 2009 at 22:26:56 -

Oh, whoops. I hate capital sensitive languages. I thought that was just a linux thing. Guess not.

What's the benefits of a capital sensitive language anyways?

 
n/a

Xgoff



Registered
  22/02/2009
Points
  135
6th November, 2009 at 00:45:59 -


Originally Posted by UrbanMonk
Oh, whoops. I hate capital sensitive languages. I thought that was just a linux thing. Guess not.

What's the benefits of a capital sensitive language anyways?


most programming languages are case-sensitive, actually

i doubt there's really any benefits to a language being case-sensitive as opposed to not, though on a lower level it's easier to implement them as CS, since you only have one character meaning something instead of two

CS does allow you to have two or more variables with the "same" name, and in cases where those variables are very closely related, it can be convenient for them to share the "same" name as opposed to cluttering them up with underscores or something. for example, in that dialogue script i posted, 'Dialogue' objects use the 'dialogue' table. of course abusing this ability can cause confusion, but then again so can the lexical scoping lua uses:
function doSomething (table)

return table.sort(table)
end

it's very likely you'll get an error when running that, because the 'table' variable in the parameter list overrides the global 'table' when you try accessing it. that's bitten me a couple of times when i haven't paid attention

mmf is semi-case sensitive; you can type something like 'val()' or 'VAL()' or 'vAl()' and it'll take it, but it'll automatically convert it to the "correct" form by the time you view that expression again

 
Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
6th November, 2009 at 00:50:47 -

Yeah, well on a lower level it would of course make sense, but I still don't see the point in doing it that way.

I don't want people to be confused by it, so I'll most likely make a parse table to convert everything to the correct cases, and for the rest make it lowercase.

 
n/a

Xgoff



Registered
  22/02/2009
Points
  135
6th November, 2009 at 02:27:01 -

depending on what you're doing, you might be able to get away with string.lower()

 
Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
6th November, 2009 at 03:05:34 -

Thanks, and thanks for all your help so far!

I understand that I can get data about mmf objects directly, but I was wondering if mmf can pass information to Xlua from actions. I asked about this already, but I didn't get the answer I was looking for.

So.. Is it possible to create a function that returns data instead of actually carrying out an action. Such as.

GetPlayerName() could return the players name in the form of a string. So

Print(GetPlayerName()) Would print the players name?

Also how do I combine data types in a single input line. OR more specifically how can I include varibles in, say, strings. like:

Print("Hello "+GetPlayerName()+" How do you do?")

But I know that's not how it works, so how would I accomplish this?

 
n/a

Xgoff



Registered
  22/02/2009
Points
  135
6th November, 2009 at 04:42:52 -

if GetPlayerName() is something you'd use in an 'On Function' event, then look under the 'MMF Functions' menu for 'Push String Return'

then you'd do something like this:
On Function "GetPlayerName"

--> XLua - Push String Return: player_name [or whatever GV/AV/array/whatever it's in]

lua does automatic conversions (except in a couple of cases irrelevant here) when possible; right here you don't even have to worry about it, since that function already returns a string. however, lua uses '..' and not '+' to concatenate strings. if you wanted to force a conversion, you could use the tostring() function around whichever function or value you wanted to convert

so as it is, you'd use: Print("Hello " .. GetPlayerName() .. " How do you do?")

 
Image

Retriever2



Registered
  18/04/2009
Points
  1
6th November, 2009 at 06:18:26 -

Hello, I'm the author of XLua, and I just wanted to throw in that the real reason you should not use the original Lua Object, or the LuaPlus object, is because they are both unstable and crash under larger scripts, and are no longer maintained. That is why XLua came into existence.

XLua is really based on the LuaPlus way of doing things, but you can also do things the old Lua-Object way too. The action "Lua Functions->Inline Parameters->Call With Delimited String" is the same as the Lua-Object "Call Function" action. You can also use DoCall() in your lua scripts to call On Function conditions, like you do in the Lua-Object. Sometimes this is the best way to do things, but it's worth taking the time to learn the other actions because they preserve type information and make some tasks easier.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
6th November, 2009 at 15:34:52 -


Originally Posted by Xgoff
however, lua uses '..' and not '+' to concatenate strings. if you wanted to force a conversion, you could use the tostring() function around whichever function or value you wanted to convert

so as it is, you'd use: Print("Hello " .. GetPlayerName() .. " How do you do?")



Great! That's the info I was looking for. That's pretty similar to php, I was trying to use "blah " . " Blah" but I see I need two periods now. Nice.


Originally Posted by Retriever2
XLua is really based on the LuaPlus way of doing things, but you can also do things the old Lua-Object way too. The action "Lua Functions->Inline Parameters->Call With Delimited String" is the same as the Lua-Object "Call Function" action. You can also use DoCall() in your lua scripts to call On Function conditions, like you do in the Lua-Object. Sometimes this is the best way to do things, but it's worth taking the time to learn the other actions because they preserve type information and make some tasks easier.



I'm going to take a look at all the new commands too. Some of my functions need to be called from within mmf2 because I want to hide what they are doing. Mostly communicating with the get object to get info from a php script.

Thanks to both of you!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click