LUA : get / set scene value

  • #20, by LebosteinThursday, 19. February 2015, 13:14 6 years ago
    I think I have to wait for the official build to test this. In 4.1 this "shorthand" method seems not finished. I would also work as a beta tester, if it is possible.

    Key Killer

    601 Posts


  • #21, by afrlmeThursday, 19. February 2015, 13:28 6 years ago
    I think I have to wait for the official build to test this. In 4.1 this "shorthand" method seems not finished. I would also work as a beta tester, if it is possible.


    That would be up to Alex. I only have access to team builds because they get shared to me by Thomas or David, because I provide support, documentation & test things out.

    * edit: @ Alex: you are correct. I think Simon improved the shorthand code since I last properly tested it out as I found it a little confusing when I tested it properly in 4.0.1 (I think it was) as it was a bit hit & miss in regards as to how you had to access the fields / tables because for instance only .Int & .String was working for accessing values before, which was something due to a string stripper thing or something that Simon implemented so that we didn't have to write out the full field / table name. Also a lot of the links were not accessible. For instance: I could not access values of a game table, such as game.CurrentCharacter.CharacterValues["name"] etc.

    Also .Int does not return any errors for me, whether reading or writing.

    P.S: @ Lebostein: It's also possible to access object names without the square brackets & quotation marks, but I do recommend using the brackets because it's the safer option. Some names may cause issues depending on what characters or special characters they contain. v-money for instance would generate an error because - is the Lua operator for subtract or inverse.
    Characters.jacob.CharacterValues.money.ValueInt = 20 -- should still work (well it does in the build I'm using)
    1
    2

    Imperator

    6842 Posts

  • #22, by SimonSThursday, 19. February 2015, 14:10 6 years ago
    The access on tables is not yet in the public build, so
    Characters.jacob.CharacterValues.money
    1
    2

    won't work yet.

    Thread Captain

    1367 Posts

  • #23, by LebosteinThursday, 19. February 2015, 14:15 6 years ago
    Tables (means associative arrays) without the key name in brackets are very confusing! I would forbid such syntax but you can not see if the next branch after the dot (.) is a parameter or a key name! The whole structure is lost with that syntax...

    Key Killer

    601 Posts

  • #24, by SimonSThursday, 19. February 2015, 14:20 6 years ago
    You can't forbid that, that's how Lua works, Lua tables can be accessed with . or with []. Nothing you can do about that. You can actually even write:
    Characters["jacob"]["CharacterValues"]["money"]
    1
    2

    Thread Captain

    1367 Posts

  • #25, by LebosteinThursday, 19. February 2015, 14:22 6 years ago
    Ok, but now I know that I can't love lua smile

    Key Killer

    601 Posts

  • #26, by afrlmeThursday, 19. February 2015, 14:39 6 years ago
    Ok, but now I know that I can't love lua smile


    It's easy once you get used to it. Just employ whichever method you prefer for accessing / writing tables. The rest of it is easy enough. Lua has loads of math functions for sorting out math related things. Also creating functions & variables is easy. Lua is a doddle in comparison with the C languages as you don't have to arse around declaring what everything is.

    I found the language a little bit whatever at first, but I prefer to use Lua instead of action parts, whenever possible, as it's still much faster & easier than clicking around the editor like a mad man.

    Imperator

    6842 Posts

  • #27, by LebosteinThursday, 19. February 2015, 16:25 6 years ago
    I am big a fan of Python. This language is designed by minimalism with strict syntax rules. I have never used a language that was so easy to learn and so powerful with the standard set of commands.

    Key Killer

    601 Posts

  • #28, by afrlmeThursday, 19. February 2015, 17:20 6 years ago
    I've not looked into python. I'm not sure, but I think some game engines support python for extensibility no?

    https://www.panda3d.org/
    http://www.pygame.org/news.html
    http://www.renpy.org/
    http://kivy.org
    http://www.pyglet.org/
    http://cocos2d.org/

    I can't say whether or not any of them are any good though. Ren'py one is mostly for visual novels. That kivy one looks interesting as it can be used to create various different kinds of applications & not just games.

    Unless you're willing to switch to another engine then I'm afraid you are stuck with Lua & the Visionaire action parts; or just the action parts if you don't want to bother learning / using Lua.

    Imperator

    6842 Posts

  • #29, by AlexThursday, 19. February 2015, 18:30 6 years ago
    Python is a very nice language but it was not designed for native embedding. Actually we already integrated Python years ago (I don't know if it ever went public) but the integration was a nightmare. Everything was extremely complicated. With Lua I could finish the whole integration in a few days. Lua is very well designed, easy to embed and has good performance (which is important for a game engine).

    Great Poster

    378 Posts

  • #30, by BigStansFriday, 20. February 2015, 00:04 6 years ago
    Python is one of the slowest ones.
    It's more than 400 times slower than c++. http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?t...

    Google's V8 javascript engine was faster than python. And nothing is easyer to learn and understand as Javascript. It has also an very good c integration, but it uses a lot of memory and cpu. Not the right choice for games.

    Googles V8 javascript Engine was faster than Python, but for games, Lua is the best choice.
    It's coss platform, has an extreme low memory usage, supports embedded devices and was the fastest one. Lua can call directly C functions (FFI).
    Thats while triple A (AAA) engines have lua bindings too, like Crytek and Unreal.

    So, with lua we're right wink
    It did not have more functions as all other languages, because we must integrate them.
    For example:
    something like
    import datetime
    from python, has no function, because internally it did not gives the lib for datetime.
    Or have a look at telltale games. The games are nearly completely scripted with lua.

    Great Poster

    361 Posts

Write post