Add ExpGaming Lib and ranks are in working condition

This commit is contained in:
Cooldude2606
2017-07-01 21:54:35 +01:00
parent 126e51a6c3
commit 2ca6ef6d77
5 changed files with 110 additions and 70 deletions

View File

@@ -22,40 +22,3 @@ credit_loop(require("locale/StdLib/event"))
credit_loop(require("locale/file-header"))
Event.register(-1,function() global.credits = credits end)
----TEMP-------------------------------------------------------------------------------------
function table.val_to_str ( v )
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and table.tostring( v ) or
tostring( v )
end
end
function table.key_to_str ( k )
if "string" == type( k ) and string.match( k, "^[_%player][_%player%d]*$" ) then
return k
else
return "[" .. table.val_to_str( k ) .. "]"
end
end
function table.tostring( tbl )
local result, done = {}, {}
for k, v in ipairs( tbl ) do
table.insert( result, table.val_to_str( v ) )
done[ k ] = true
end
for k, v in pairs( tbl ) do
if not done[ k ] then
table.insert( result,
table.key_to_str( k ) .. "=" .. table.val_to_str( v ) )
end
end
return "{" .. table.concat( result, "," ) .. "}"
end