0


what changes are needed to get amx2d to work on linux??

flag offensive
asked 2010-05-22 22:54:51.649428
1
add comment
4 Answers:
0


Aimz gave me this ..

replace userinit() inside users.lua Code: function userinit() users = {} for line in io.lines(conf_dir.."users.cfg") do if #line > 0 then local tempUser = {} for word in string.gmatch(line, "%w+") do table.insert(tempUser, word) end if not tempUser[4] then tempUser[4] = "user" end users[tempUser[2]] = {id = tempUser[1], password=tempUser[3], privilege = tempUser[4], time = tempUser[5], stime = tempUser[6], usgn = tempUser[7], lastlogin = tempUser[8]} lastUser = lastUser+1 end end

priv = {} for line in io.lines(conf_dir.."priv.cfg") do line = string.sub(line,0,string.len(line)-1) if #line > 0 then table.insert(priv, line) end end

end

replace modinit() from mods.lua Code: function modinit(file)

if (file == nil or type(file) ~= "string") then file = confdir.."mods.cfg" else file = confdir..file end if not io.open(file) then file = confdir.."mods.cfg" end for line in io.lines(file) do if not (string.sub(file, 1, 2) == "--") then line = string.sub(line,0,string.len(line)-1) local f = loadfile(modsdir..line..".lua") if type(f) =="function" then f = toMod(f()) print("Mod "..line..".lua sucessfully initialized") else print("Mod "..line..".lua failed to initialize") end end end altpriv = {} for line in io.lines(confdir.."altprivileges.cfg") do local fn = loadstring("altpriv."..line) if fn then fn() end end acts = {} acts.default = function(p, typ, cmd) msg2(p, "Error: Command Does Not Exist: "..typ) end admacts = {} admacts.default = function(p, typ, cmd) msg2(p, "Error: Admin Command Does Not Exist: "..typ) end for g, v in pairs(G) do if type(v) == "function" then local n = {} for word in string.gmatch(g, "%w+") do table.insert(n, word) end if n[1] == "act" then acts[n[2]] = g elseif n[1] == "adm"then admacts[n[2]] = g if not n[3] then n[3] = "user" end if altpriv[n[2]] then n[3] = altpriv[n[2]] end tempPriv = {[n[3]] = n[3]} for i,word in ipairs(adminhierarchy(n[3])) do tempPriv[word] = word end cmd_priv[n[2]] = tempPriv

end end end action = switch(acts) admin_action = switch(admacts) end

replace cmdinit() in cmds.lua Code: function cmdinit() for line in io.lines(conf_dir.."cmds.cfg") do local cmd = {} line = string.sub(line,0,string.len(line)-1)

--Future: string.split() for word in string.gmatch(line, "[^%s]+") do table.insert(cmd, word) end

local symbol = cmd[1] -- Symbol local admin = cmd[2] -- Admin or Not local text = cmd[3] -- What to parse

--[-- if not admin then admin = "false" end if not text then text = "" end --]-- Condition Chunk for all cmds to work.

if symbol and admin then text = string.sub(line, #symbol+#admin+2) end

if not (string.lower(admin) == "true" or string.lower(admin) == "false") and type(admin) == "string" then text=admin admin = false elseif string.lower(admin) == "true" then admin = true else admin = false end

cmd_prefix[symbol]={cmd = text, admin = admin} end end

permanent link | flag offensive
answered 2010-05-23 03:53:50.316784
1
add comment
0


Most of the platform specific components revolves around the ways that Windows and Linux treats "\r". Simply string:replace("\r","") while processing files and the library should start to work. Most *nix platforms should not have these sorts of problems so only do this when necessary.

As for most of the modifications above, the

line = string.sub(line,0,string.len(line)-1)

can be replaced with

line = line:gsub("\r","")
permanent link | flag offensive
answered 2010-05-23 06:00:46.856916
41
add comment
0


I tried the changes stated above but I'm still getting the following error:

LUA ERROR: sys/lua/amx2d/core/help.lua:1: attempt to call global 'newMod' (a nil value)

Any more advice on this?

I'm using Ubuntu Linux 10.04

Edit: Got it to work all I did was add the same line:

line = line:gsub("\r","")

to the main.lua at line 63 ( the core_init() function )

permanent link | flag offensive
answered 2010-08-16 00:14:53.593702
5
add comment
0


The good old Win vs *nix string termination clash T_T, and to think that we would've standardized this by now xD

permanent link | flag offensive
answered 2010-08-16 15:42:21.024962
41
add comment
Your answer:
You are now not logged in but you can answer first and then login
toggle preview



Tags:

× 1
× 1
× 1

Asked: 1 year, 12 months ago

Seen: 1,429 times

Last updated: 1 year, 9 months ago

Related questions


Made with Django.