Lua-isms in your expressions.

adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,867
edited January 10 in News from the Dev Team

Hey, so while doing support work and debugging some games, I've noted that people occasionally use lua code in their expression.

And while that will work fine for now, it will usually break if you try to move your game to HTML5.

So, to help me plan for the future: What lua functions and methods to do you use in your expressions?

I'll be looking to either provide official replacements over time (or have the HTML5 converter handle switching things over).

Thanks!

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,864

    I am really torn on what to suggest!

    On one hand, GameSalad is great as a teaching tool because because of the expression editor's built in functions and methods. It is hard for a student to make a mistake when all you need to do is select from the drop down menu. Its great!

    But on the other hand, I have found that (for me) writing lua based expressions is one of GameSalad's superpowers! It has been great to write a simple lua expression that takes things to a whole new level.

    So in addition to what is found in the menus, I would request that we would be able to use the following in HTML5:

    Arithmetic: + - * /
    Power: ^
    Negation: -( )
    Modulo: %
    Relation (arithmetic and string): == ~= < > <= >=
    Boolean Logic: and or
    Escapes: \n \" \' \\ \t \###
    Concatenation: ..

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,867

    so most of of those you can use (though boolean logic is || and &&). Concatenations work already i think. I'm mostly asking about lua functions or methods people are using that aren't usually documented.

  • adriangomezadriangomez Member, PRO Posts: 139

    What! 0_o. Head blown that I can use lua inside the expression editor. I knew it was lua just didn't realize that it would not be all filtered out. Thank you @adent42 for starting me down a wormhole.

  • ArmellineArmelline Member, PRO Posts: 4,957

    @adent42 said:
    So, to help me plan for the future: What lua functions and methods to do you use in your expressions?

    I find being able to use things like this really handy.

    (self.random==1)and("Yes")or(self.random==2)and("No")or(self.random==3)and("Maybe")

    Particularly if I'm putting it in a display text, and normally only if there are more conditions and the situation is appropriate. But this can be done without LUA, it's just a bit more long-winded.

    I occasionally use upper, lower and reverse too. Official replacements for those would be great.

    Honestly though it's not overly problematic to lose any of them though. There are other things I'd personally much rather your time go to, like making sounds playable through an expression.

  • ArmellineArmelline Member, PRO Posts: 4,957
    edited January 13

    Also there are too many stickied threads. I just spent ages looking for this one to edit my reply (I didn't in the end) and eventually realised it was one of the sea of yellow posts now. I need to dismiss some of them I guess, but for a new user I'm sure it's overwhelming.

Sign In or Register to comment.