Lua

Tagged: 

This topic contains 20 replies, has 5 voices, and was last updated by  Samah 2 years, 10 months ago.

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #2058

    therevills
    Participant

    Okay… but when using the zip from GitHub it doesnt get included… also what happens if they remove the repos? (not saying they will… but you never know ;))

    #2059

    Samah
    Participant

    Always the pessimist! 🙂
    I’ll have a look at it tonight.

    Edit: Done. Now using the official 5.3.3 release.

    #2079

    therevills
    Participant

    Haha!

    I’ll have to have a good play over the weekend 🙂

    (BTW luadist folder is still there)

    #2081

    Samah
    Participant

    Fixed. Stupid git (not you).
    git rm --cached native/luadist

    I’m working on a simple Mojo demo project at the moment, hopefully with a “reload script” shortcut. At the moment you’re mostly limited to calling MX2 functions that you declare yourself, so it’s still WIP for usefulness. Coming along, though!

    Reloading scripts will need to use DoFile rather than DoString(LoadString), as I believe the assets get baked into the distribution.

    Note when using DoString/DoFile/PCall, make sure to wrap it with an if statement and grab the string value at the top of the stack. If there was an error somewhere in your script, that error message will be on the stack. You can also give custom error messages in your MX2 registered functions using state.Error/ lua_error. This will push the error message and raise an exception that’s caught by the Lua VM. Note that this call does a long jump and never returns.

    #2271

    Samah
    Participant

    Worked a bit more on the class binding. At the moment you still need to know how to do some low level stuff, but I hope to make this cleaner in the future.

    I added a very simple Mojo demo, too. It has a placeholder for “script reloading”, but you’ll need to change it to DoFile and make sure the Lua file is in the right place. Whenever I test it from my build script, it tries to look in the root monkey2 directory rather than the current directory.

    I’d love to see some of your usage examples so that I know how to make it betterer! Note: Coroutines are much nicer for handling entity logic, rather than constantly calling DoString as in my example.

    #2472

    Samah
    Participant
Viewing 6 posts - 16 through 21 (of 21 total)

You must be logged in to reply to this topic.