table.save

Post Reply
FormerZmudUser
Posts: 13
Joined: Fri May 15, 2009 12:52 pm

table.save

Post by FormerZmudUser »

Quoting from the manual:
table.load( file, table ) restores a Lua table from a data file that has been saved with table.save()
table.save( file, table )saves the given table into the given file

I don't get this to work. Any help would be appreciated!

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: table.save

Post by Heiko »

I have forgotten to reenable the table-save/restore functions after disabling them for testing purposes.
Sorry, I'll fix it on sunday. Until then, just copy the functions from LuaGlobal.lua and put them in a script. Changes in LuaGlobal.lua itself will have no effect as the original is restored on startup.

FormerZmudUser
Posts: 13
Joined: Fri May 15, 2009 12:52 pm

Re: table.save

Post by FormerZmudUser »

How do I get the user's home directory?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: table.save

Post by Vadi »

We don't offer a function for this yet, unfortunately. But needing to know the home dir sounds awfully fishy!

If you want to store settings, this function should return the dir you should stuff them in for linux / windows:

Code: Select all

function get_settings_dir()
    if os.getenv("WINDIR") ~= nil then -- Unix
        if os.getenv("XDG_CONFIG_HOME") == nil then
            return os.getenv("HOME") .. "/.config"
        else
            return os.getenv("XDG_CONFIG_HOME")
        end
    else -- Windows
        return os.getenv("APPDATA")
    end
end
Needs filling in for OS X though.

Post Reply