Running 2 scripts with XLua?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I'm relatively new to using XLua. Using this tutorial:

    Please login to see this link.

    I got coroutines and yielding working. But notice that tutorial loads 2 lua files: "data.lua" and "a_script.lua." The thing is, the "a_script.lua" file never actually does anything, and I need some similar functionality where I can load in a "Base.lua" file with all my global members and functions, and then load smaller scripts for individual cutscenes, etc. I can't get the "runscript" function in a 2nd script to actually run.

    I've seen this done in other clickteam games, so surely there's a way?

  • I found I can get another script running by loading it in the Lua file itself, using:

    Code
    function LoadFile(file)
        dofile(file);--Filename
        runscript();--This is the coroutine function
    end

    However, if I try to yield that script, it gives the error: "attempt to yield across metamethod/c-call boundary"

    I look that up and it's something about calling yield in a metamethod, but the definition of "metamethod" doesn't sound like something I'm using. I also wouldn't know how to release the script once I'm done with it.

    Edit: Putting the coroutine creation into the subscript itself (rather than the base) allows it to work, though a bit cumbersome. So the end of every script file would have:

    Code
    script = coroutine.create(runscript)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!