diff options
Diffstat (limited to 'apps/plugins/lua/lauxlib.c')
-rw-r--r-- | apps/plugins/lua/lauxlib.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/plugins/lua/lauxlib.c b/apps/plugins/lua/lauxlib.c index 88abc3cde0..fd71e07217 100644 --- a/apps/plugins/lua/lauxlib.c +++ b/apps/plugins/lua/lauxlib.c | |||
@@ -200,6 +200,19 @@ LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, | |||
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | LUALIB_API int luaL_checkboolean (lua_State *L, int narg) { | ||
204 | int b = lua_toboolean(L, narg); | ||
205 | if( b == 0 && !lua_isboolean(L, narg)) | ||
206 | tag_error(L, narg, LUA_TBOOLEAN); | ||
207 | return b; | ||
208 | } | ||
209 | |||
210 | |||
211 | LUALIB_API int luaL_optboolean (lua_State *L, int narg, int def) { | ||
212 | return luaL_opt(L, luaL_checkboolean, narg, def); | ||
213 | } | ||
214 | |||
215 | |||
203 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { | 216 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
204 | if (!lua_getmetatable(L, obj)) /* no metatable? */ | 217 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
205 | return 0; | 218 | return 0; |