10-22-2013, 09:40 PM
(10-22-2013, 09:39 PM)bearbin Wrote: [ -> ]Easiest thing to do is probably concat the table and resurrect it on the other side, asumming it's full of strings or ints.
It's full of functions

(10-22-2013, 09:39 PM)bearbin Wrote: [ -> ]Easiest thing to do is probably concat the table and resurrect it on the other side, asumming it's full of strings or ints.
function LoadPasswords(Path) local File = io.open(Path) local Table = {} if File then for I in File:lines() do local Split = StringSplit(I, ";") Table[Split[1]] = Split[2] end File:close() else local File = io.open(Path, "w") File:write() File:close() end local Object = {} function Object:GetPassFromPlayer(PlayerName) if Table[PlayerName] ~= nil then return true, Table[PlayerName] end return false end function Object:AddPass(PlayerName, Password) if Table[PlayerName] == nil then Table[PlayerName] = md5(Password) return true end return false end function Object:RemovePlayer(PlayerName) if Table[PlayerName] ~= nil then Table[PlayerName] = nil return true end return false end function Object:ChangePass(PlayerName, NewPassword) if Table[PlayerName] ~= nil then Table[PlayerName] = md5(NewPassword) return true end return false end function Object:PlayerExists(PlayerName) if Table[PlayerName] ~= nil then return true end return false end function Object:ReturnTable() return Table end function Object:Save() local File = io.open(Path, "w") for I, k in pairs(Table) do File:write(I .. ";" .. k .. "\n") end File:close() end return Object end
local AllLoadedStuff = {} function LoadPasswords(path) -- ... do stuff -- Create a unique key AllLoadedStuff[Key] = WhateverYouLoaded return Key end -- Former Object:GetPassFromPlayer function GetPassFromPlayer(Key, PlayerName) local Object = AllLoadedStuff[Key]; -- Still use Object functions return Object:GetPassFromPlayer(PlayerName) -- Or copy everything in here if Table[PlayerName] ~= nil then return true, Table[PlayerName] end return false endNot sure if it's clear what I mean?