No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

  • lua_newthread

    lua_newthread, has anyone had any experience with this? Its covered here a bit but I'm not really getting if its something to be used within AMS as is or if its something for use with whatever creates the AMS app, just looking for something other than Lanes to deal with background drawing of windows that wont lock the thread.

  • #2
    lua_newthread creates a new mirrored luastate , not a thread

    this does not mean a new thread , this API function provides a way to implement multi-tasking in Lua environment

    for example , you have a variable in Global Functions

    name = "John"

    when you create a thread and attempt to change this variable directly
    you will damage/lock current Lua stack ,because thread runs in a different context

    lua_newthread , creates a new luastate that is globally mirrored to master state
    you will keep this pointer associated with your actual thread and when you want to change that variable you will use this mirrored lua state because it has an independent execution stack that will not cause any problem

    you will create this mirrored state in your thread callback function , so it will created in new thread's context and globally associated with master table

    i have had a thread plugin that i could not complete for several reasons
    if there is some interest on multi-threading on AMS then maybe i can try to complete it and publish
    but it will not be free Is Closed.

    Facebook Page


    • #3
      I was hoping lua_newthread could be used as a read only non thread blocking background process to simply update a window and it seems it will, got a small example?

      But yes I'm interested in multi threading on AMS as I'm sure lots of folks are so if you can create something that would have all the functions and variables from _G working alongside another instance of _G with data being passed to an fro then your on to a winner.