What happened to OC? - CLOSED Carnage?!
Sign in to follow this  
Followers 0
Devieth

Saving Lua tables with FFI

I am in need of a multi-threaded ffi module that can save a Lua table (so that it does not use up HaloCE's thread why saving a large Lua table to a file.)

Current Lua code writing the file: https://pastebin.com/s6aVdNkF

I need it to save the file formatted like so:

return { 
    [1] = { 
        [35] = { 
            [1] = { 
                [1] = "Tooth",
                [2] = "-1"
            },
            [2] = { 
                [1] = "Donut",
                [2] = "-1"
            },
            [3] = { 
                [1] = "Hambone",
                [2] = "-1"
            },
            [4] = { 
                [1] = "Goat",
                [2] = "-1"
            }
        }
    }
}

 

Edited by Devieth

Share this post


Link to post
Share on other sites

Tiddy-bits:

Update: I am still in need of an ffi module to do this due to the limitations of SAPP's Lua implementation running off of HaloCE's main thread thus causing the server to lock up until the file is finished being saved.

Share this post


Link to post
Share on other sites
4 hours ago, Devieth said:

Update: I am still in need of an ffi module to do this due to the limitations of SAPP's Lua implementation running off of HaloCE's main thread thus causing the server to lock up until the file is finished being saved.

It sounds like reading a table isn't going to be possible with LuaJIT's FFI. You're going to need a Lua module to do this. I'm not sure what version LuaJIT SAPP uses, as the SAPP site is dead, but one needs to know this to code a Lua module as a DLL file.

Share this post


Link to post
Share on other sites
42 minutes ago, 002 said:

It sounds like reading a table isn't going to be possible with LuaJIT's FFI. You're going to need a Lua module to do this. I'm not sure what version LuaJIT SAPP uses, as the SAPP site is dead, but one needs to know this to code a Lua module as a DLL file.


Reading the table isn't a problem as long as it is saved the way it is shown above.  Also SAPP is using LuaJIT 2.1.0-beta2. 

print(jit.version)

 

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.