Page 4 of 4
Re: What am I doing wrong here?
Posted: Thu Jun 09, 2011 7:40 pm
by Jasoco
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.
Re: What am I doing wrong here?
Posted: Thu Jun 09, 2011 7:53 pm
by bartbes
Really looking forward to it.
Re: What am I doing wrong here?
Posted: Thu Jun 09, 2011 7:59 pm
by Jasoco
Now you're putting too much pressure on me.
What if I fail!!!!!???? OH NOES!!
Nah, I won't.
Re: What am I doing wrong here?
Posted: Thu Jun 09, 2011 10:42 pm
by BlackBulletIV
Jasoco wrote:Here's a question.
How's come I can do this:
Code: Select all
enemySet.goomba = {}
function enemySet.goomba:setup(v)
...
end
But I can't do this:
Code: Select all
enemySet["goomba"] = {}
function enemySet["goomba"]:setup(v)
...
end
Yeah, I've come across that many times; Lua syntax doesn't allow it for some reason.
Re: What am I doing wrong here?
Posted: Thu Jun 09, 2011 11:32 pm
by miko
Jasoco wrote:Here's a question.
How's come I can do this:
Code: Select all
enemySet.goomba = {}
function enemySet.goomba:setup(v)
...
end
But I can't do this:
Code: Select all
enemySet["goomba"] = {}
function enemySet["goomba"]:setup(v)
...
end
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.
You could try this:
Code: Select all
enemySet["goomba"] = {}
enemySet["goomba"].setup=function(self, v)
...
end
Re: What am I doing wrong here?
Posted: Fri Jun 10, 2011 12:24 am
by Robin
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.
Re: What am I doing wrong here?
Posted: Fri Jun 10, 2011 1:50 am
by BlackBulletIV
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.
Yeah I'd say that's it.