Forum

> > Unreal Software > CS2D - Lua reference (bug found)
Forums overviewUnreal Software overviewLog in to reply

English CS2D - Lua reference (bug found)

10 replies
To the start Previous 1 Next To the start

old CS2D - Lua reference (bug found)

VADemon
User Off Offline

Quote
Sorry for making a new thread (I didn't find a similar one)

Lua's function example for cs2d lua cmd object contains an error:
1
2
3
4
local objectlist=object(0,"table")
for _,id in pairs(objectlist)
   print id
end
there's no do after for

It should be like this:
1
2
3
4
local objectlist=object(0,"table")
for _,id in pairs(objectlist) do
   print(id)
end
I would also write print(id) and not just print id

I think it's a good idea when you find some bugs in the reference/write small functions (like DC did) and post them here.

old Re: CS2D - Lua reference (bug found)

MikuAuahDark
User Off Offline

Quote
i found too like that at cs2d lua cmd hostage
1
2
3
4
local hostagelist=hostage(0,"table")
for _,id in pairs(hostagelist)
	print id
end
it must be
1
2
3
4
local hostagelist=hostage(0,"table")
for _,id in pairs(hostagelist) do
	print(id)
end

old Re: CS2D - Lua reference (bug found)

Apache uwu
User Off Offline

Quote
Yes you are right, however that only applies to direct input strings.

For example:

1
print "Hello World"

works √ , however

1
2
myVar="Hello World"
print myVar

fails × , and in this case, id is a variable, so print id will also fail.

old Re: CS2D - Lua reference (bug found)

VADemon
User Off Offline

Quote
cs2d lua cmd closeitems
Same errors everywhere?

1
2
3
4
local itemlist=closeitems(1,5)
for _,id in pairs(itemlist)
   print item(id,"name")
end
Must be:
1
2
3
4
local itemlist=closeitems(1,5)
for _,id in pairs(itemlist) do
   print(item(id,"name"))
end

The same with:
cs2d lua cmd player
To the start Previous 1 Next To the start
Log in to replyUnreal Software overviewForums overview