I'm using the "..." in my function and then adding it's contents to a table in my object (hump.class btw). When I iterate through with pairs it just gives me strange things:
1 Documents\Trision\Trision.love
-2 C:\Program Files\LOVE\love.exe
-1 embedded boot.lua
instead of a list of numbers. Why is this happening?
"..." argument returning strange things
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 21
- Joined: Fri Nov 02, 2012 10:23 pm
"..." argument returning strange things
- Attachments
-
- Trision.love
- (13.83 KiB) Downloaded 98 times
- slime
- Solid Snayke
- Posts: 3161
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: "..." argument returning strange things
The 'arg' variable is a global table holding the command-line arguments given to LÖVE, it doesn't contain the vararg list in a function. Unfortunately the online edition of the Programming in Lua book is a very old version written for an old version of Lua, so it contains the wrong information in this case.
You can do something like this instead:
You can do something like this instead:
Code: Select all
init = function(self, ...)
self.test = {...}
end
Who is online
Users browsing this forum: Bing [Bot] and 4 guests