Page 2 of 2
Re: Deceptively basic Lua tables question
Posted: Thu Nov 18, 2010 8:39 pm
by zac352
kikito wrote:Well, to each one his thing. Some people don't like Lua just because it isn't strongly typed
.
I'm getting a little crazy from the lack of OOP. Squirrel is simple, has OOP, has tables, ...
Re: Deceptively basic Lua tables question
Posted: Thu Nov 18, 2010 10:33 pm
by kikito
And it also has a nice and helpful
forum.
(may Ganesha forgive me)
Re: Deceptively basic Lua tables question
Posted: Thu Nov 18, 2010 10:43 pm
by zac352
kikito wrote:And it also has a nice and helpful
forum.
(may Ganesha forgive me)
Don't worry, when I start on physibots again I'm putting in both Lua and Squirrel. Squirrel first (just because of the simplicity of implementing it.
).
Re: Deceptively basic Lua tables question
Posted: Fri Nov 19, 2010 4:35 am
by Xgoff
kikito wrote:A nice solution would be having nil[whatever] return nil silently, without raising an error. I believe in
Squirrel they do just that. I don't think it can be done in Lua.
Code: Select all
debug.setmetatable(nil, { __index = { } })
print((nil).test) --> nil
probably won't make some people very happy if they see it though
Re: Deceptively basic Lua tables question
Posted: Fri Nov 19, 2010 6:47 am
by bartbes
I mean, you can do anything with your code, nobody will take that away from you, but I would like to note that the debug library is not to be used in production code (as stated by the lua manual.. somewhere).
Re: Deceptively basic Lua tables question
Posted: Fri Nov 19, 2010 8:22 am
by Xgoff
you're probably fairly safe as long as you're effectively sandboxing user code. the debug library may be less dangerous than allowing loading of bytecode (especially in 5.2), at least, which is something i bet a lot of people overlook