I'm getting a little crazy from the lack of OOP. Squirrel is simple, has OOP, has tables, ...kikito wrote:Well, to each one his thing. Some people don't like Lua just because it isn't strongly typed .
Deceptively basic Lua tables question
Re: Deceptively basic Lua tables question
Hello, I am not dead.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Deceptively basic Lua tables question
And it also has a nice and helpful forum. (may Ganesha forgive me)
When I write def I mean function.
Re: Deceptively basic Lua tables question
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. ).kikito wrote:And it also has a nice and helpful forum. (may Ganesha forgive me)
Hello, I am not dead.
Re: Deceptively basic Lua tables question
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
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Deceptively basic Lua tables question
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
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
Who is online
Users browsing this forum: Amazon [Bot] and 10 guests