• Lua doesn't store my tables!
    4 replies, posted
Hey facepunch, It worked just fine, but then suddenly my tables get stored never again... it says [code]attempt to index global 'glon' (a nil value)[/code] of the glon.encode() function. I thought it might be my tables not working and I was right. I tested it with this: [lua]function GM:PlayerAuthed(ply, SteamID) if (!file.IsDir("PlotRP", "DATA")) then file.CreateDir("PlotRP") file.CreateDir("PlotRP/player") end if (!file.Exists( "PlotRP/player/".. string.gsub(tostring(SteamID), ":", "_") ..".txt", "DATA") ) then ply.Properties = { } ply.Properties["Funds"] = 5000 ply.Properties["Plot"] = "" print(ply.Properties["Funds"]) -- WITH THIS I TESTED IF MY TABLES ARE NIL AND YES, IT GAVE ME NO PRINT OUTPUT file.Write( "PlotRP/player/".. string.gsub(tostring(SteamID), ":", "_") ..".txt", glon.encode(ply.Properties)) else raw_properties = file.Read( "PlotRP/player/".. string.gsub(tostring(SteamID), ":", "_") ..".txt", "DATA") ply.Properties = glon.decode(raw_properties) end end[/lua] The lol-thing is, that it worked before... I didn't change anything either. (I am currently coding in gmod13)
Did you require "glon"?
No :v: *HeadOnKeyboard* Just out of interest: Why did it work even without it before? (That's why I didn't noticed it yet)
I think datastream required it by default (which is no longer part of GM13). [editline]2nd April 2012[/editline] [B][URL="http://luabin.com/browse/?path=/lua/includes/modules/datastream.lua"]Confirmed.[/URL][/B]
I guess since update 15? It worked after it, too. Ah, now I get it... Before the error showed up, I deleted my garrysmod folder [url=http://wiki.garrysmod.com/page/Beta#Clean_GMod_After_Updating]as the wiki said[/url] (I thought it would kill the console spamming after shutting down a listen server while player are still connected.) I just still had the datastream module before I deleted it.
Sorry, you need to Log In to post a reply to this thread.