[Fix] HC Admin Script
21 replies22.06.15 03:39:26 pm
Hello, a lot of people has been complaining about errors on HC Admin Script since CS2D was updated, I modified a file and I'm getting no errors after that. I'd like to share that with you, and see if there's more to fix or not.
sys/lua/hc/core/main.lua
http://pastebin.com/7AM97661
sys/lua/hc/core/main.lua
http://pastebin.com/7AM97661
@
The Gajos: There's no big difference, somehow the functions weren't accepting arg as a value that is set as default on functions. So I modified unpack(arg) to ... The script should work with that anyway.

edited 2×, last 22.06.15 03:46:01 pm
Actually whats happening?
How can be sure that any other scripts are not enquering the same problem?
How can be sure that any other scripts are not enquering the same problem?
edited 1×, last 22.06.15 03:51:36 pm
@
Ajmin:
Mike disabled 'arg', but '...' is still compatible.

LuaJIT FAQ has written:
Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?
Q: My vararg functions fail after switching to LuaJIT!
LuaJIT is compatible to the Lua 5.1 language standard. It doesn't support the implicit arg parameter for old-style vararg functions from Lua 5.0.
Please convert your code to the Lua 5.1 vararg syntax.
Q: My vararg functions fail after switching to LuaJIT!
LuaJIT is compatible to the Lua 5.1 language standard. It doesn't support the implicit arg parameter for old-style vararg functions from Lua 5.0.
Please convert your code to the Lua 5.1 vararg syntax.
Mike disabled 'arg', but '...' is still compatible.
Code:
1
2
3
2
3
function f(...)
local arg = {...} -- This would be the "quickest" replacement
end
local arg = {...} -- This would be the "quickest" replacement
end
@
The Gajos: Lua 5.1 has arg built in, there's no need to define it in that case.

Code:
1
2
3
4
5
6
2
3
4
5
6
function f(...)
print("arg = "..tostring(arg))
for k, v in pairs(arg) do
print("argument "..tostring(k).." = "..tostring(v))
end
end
print("arg = "..tostring(arg))
for k, v in pairs(arg) do
print("argument "..tostring(k).." = "..tostring(v))
end
end
@
lennon: That's supposed to be all, if you have more problems you can just come here and show your errors.

arg is deprecated. It's even missing in Lua 5.2; it was a left-over from Lua 5.0 and thus existed in 5.1.
http://lua-users.org/lists/lua-l/2011-06/msg00151.html
http://lua-users.org/lists/lua-l/2011-06/msg00151.html
@
Starkkz: I can't use hats in the script , another fix ?



@
Kirito2K: I'll check that, just wait a while.
Edit: Just wondering, how does that script work? I never used this script before.

Edit: Just wondering, how does that script work? I never used this script before.
@
Kirito2K: He said within this week. He'll post the hot-fix to cover all known bugs include those who prevent the scripts to work properly. I talked with him about that on IRC.
