Re: How to check for key existence in a table (for the lazy programmer) ?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: How to check for key existence in a table (for the lazy programmer) ?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: 2015年1月31日 12:57:37 -0200
> This can easily be done by configuring Lua with the C API (supposing that you have access to the C code integrating Lua in your environment).
>
> The idea here is to add a metatable to the nil value, so that `nil[anIndex]` returns nil.
You can use debug.setmetatable(nil, ...) in Lua if you have access to debug.