English [Fix] HC Admin Script

21 replies
Goto Page
To the start Previous 1 2 Next To the start
22.06.15 03:39:26 pm
Up
Starkkz
Moderator
Offline Off
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
lol
22.06.15 03:43:38 pm
Up
The Gajos
BANNED
Offline Off
What are the differences?
22.06.15 03:45:05 pm
Up
Starkkz
Moderator
Offline Off
@user 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
lol
22.06.15 03:45:21 pm
Up
JeeewNazi
User
Offline Off
Actually whats happening?

How can be sure that any other scripts are not enquering the same problem?
edited 1×, last 22.06.15 03:51:36 pm
22.06.15 03:48:33 pm
Up
Starkkz
Moderator
Offline Off
@user JeeewNazi:
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.

Mike disabled 'arg', but '...' is still compatible.

Code:
1
2
3
function f(...)
     local arg = {...} -- This would be the "quickest" replacement
end
lol
22.06.15 03:51:11 pm
Up
The Gajos
BANNED
Offline Off
@user Starkkz: wait... then how looks the code in Lua 5.1?
22.06.15 03:58:07 pm
Up
Starkkz
Moderator
Offline Off
@user 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
function f(...)
     print("arg = "..tostring(arg))
     for k, v in pairs(arg) do
          print("argument "..tostring(k).." = "..tostring(v))
     end
end
lol
22.06.15 04:08:07 pm
Up
lennon
User
Offline Off
user Starkkz and thats all?
The game of year - CS2D
22.06.15 04:19:00 pm
Up
Starkkz
Moderator
Offline Off
@user lennon: That's supposed to be all, if you have more problems you can just come here and show your errors.
lol
22.06.15 04:21:09 pm
Up
Louie
User
Offline Off
Thx so much, now HC Admin Script is working perfectly
No system is safe.
22.06.15 05:02:35 pm
Up
apex2d
User
Offline Off
its for the new cs2d? ?
Eat Sleep Conquer Repeat. www.Radeon2D.forumid.net
22.06.15 05:15:55 pm
Up
Louie
User
Offline Off
@user apex2d: Yeah
No system is safe.
22.06.15 05:18:54 pm
Up
VADemon
User
Offline Off
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
22.06.15 05:27:23 pm
Up
Pirates killer
User
Offline Off
@user Starkkz: I can't use hats in the script , another fix ?
file cs2d [PK]Admin script V2 (32) Newbie scripting.
22.06.15 05:53:30 pm
Up
Starkkz
Moderator
Offline Off
@user Pirates killer: I'll check that, just wait a while.

Edit: Just wondering, how does that script work? I never used this script before.
lol
22.06.15 09:27:21 pm
Up
The Gajos
BANNED
Offline Off
@user Starkkz, @user Pirates killer: Hats aren't visible anywhere because CS2D got new rendering bug.
22.06.15 09:32:23 pm
Up
Starkkz
Moderator
Offline Off
@user Pirates killer: Well, I guess it's not something I can solve as user The Gajos said.
lol
22.06.15 10:37:36 pm
Up
DC
Admin
Offline Off
I'm aware of this bug and I'm working on it. Sorry
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
23.06.15 10:28:11 am
Up
Pirates killer
User
Offline Off
@user DC: So when this will be fixed ?
file cs2d [PK]Admin script V2 (32) Newbie scripting.
23.06.15 10:43:22 am
Up
Fraizeraust
Moderator
Offline Off
@user Pirates killer: 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.
To the start Previous 1 2 Next To the start