Argument Error (Solved)

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
XCaptain
Prole
Posts: 23
Joined: Tue Apr 09, 2013 11:18 am

Argument Error (Solved)

Post by XCaptain »

I have found a big bug in love 0.9.0 involving functions that use (...). The function line.midpoint(...) takes an undefined number of arguments, which love 0.9.0 will always pass the file directory instead of the given values. The fallowing .love file will work in 0.8.0 but will not work in 0.9.0.
Line.love
Broken in love 0.8.0
(1.44 KiB) Downloaded 160 times
Last edited by XCaptain on Fri Dec 27, 2013 2:25 am, edited 1 time in total.
User avatar
slime
Solid Snayke
Posts: 3133
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Argument Error

Post by slime »

The implicit "arg" table was deprecated in Lua 5.1. Unfortunately the official online version of the PiL book is written for Lua 5.0, so it gives the wrong advice for this.

Do something like local args = {...}, or local a, b = ... instead.
User avatar
XCaptain
Prole
Posts: 23
Joined: Tue Apr 09, 2013 11:18 am

Re: Argument Error

Post by XCaptain »

Thank you for tell me this, didn't know I need to use ... and not arg. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 53 guests