Welcome to Open Carnage

A resource for gamers and technology enthusiasts, with unique means of rewarding content creation and support. Have a wander to see why we're worth the time!

Sign in to follow this  
Followers 0
Devieth

Saving Lua tables with FFI

Posted (edited)

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

Members of Open Carnage enjoy an ad-free experience!

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.


status.png?customhost=ProtonNebula.com:1
status.png?customhost=ProtonNebula.com:2
status.png?customhost=ProtonNebula.com:2
competent.png

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.