What am I doing wrong here?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: What am I doing wrong here?
Yeah, I played around with it and came up with something. It's odd, but now it works how I need it to. I want my Adventure engine to have as good of a drag and drop object/actor library as it can get.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: What am I doing wrong here?
Really looking forward to it.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: What am I doing wrong here?
Now you're putting too much pressure on me. What if I fail!!!!!???? OH NOES!!
Nah, I won't.
Nah, I won't.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: What am I doing wrong here?
Yeah, I've come across that many times; Lua syntax doesn't allow it for some reason.Jasoco wrote:Here's a question.
How's come I can do this:
But I can't do this:Code: Select all
enemySet.goomba = {} function enemySet.goomba:setup(v) ... end
Code: Select all
enemySet["goomba"] = {} function enemySet["goomba"]:setup(v) ... end
Re: What am I doing wrong here?
Lua is about speed. I think the parser could be changed to support this type of grammar, but it wouldn't bring any benefit (you could use alternative ways), and it would slow down the parsing phase.Jasoco wrote:Here's a question.
How's come I can do this:
But I can't do this:Code: Select all
enemySet.goomba = {} function enemySet.goomba:setup(v) ... end
Code: Select all
enemySet["goomba"] = {} function enemySet["goomba"]:setup(v) ... end
You could try this:
Code: Select all
enemySet["goomba"] = {}
enemySet["goomba"].setup=function(self, v)
...
end
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: What am I doing wrong here?
I think it is because the function blah () ... end form uses an identifier rather than an expression. a.b and a:b are simply special cases. Like miko said, that way it is probably faster.
Help us help you: attach a .love.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: What am I doing wrong here?
Yeah I'd say that's it.Robin wrote:I think it is because the function blah () ... end form uses an identifier rather than an expression. a.b and a:b are simply special cases. Like miko said, that way it is probably faster.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 12 guests