[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PROPOSAL] more luaL_check* in lauxlib.h (for Lua 5.2)
- From: Patrick Rapin <toupie300@...>
- Date: Tue, 31 May 2011 15:44:41 +0200
> In general the luaL_check* functions deal with transferring data from Lua
> to C, and raise an error if this is not possible. If a value remains in
> Lua, such as a function or a table, it's easier to just use it as if it
> has the type you expect, and allow the lower-level checks to do their job.
This is right, so if the feature would be supported, the macros (or
functions) shall be rewritten to return a C value.
For example:
#define luaL_checkboolean(L,n) (luaL_checktype(L, (n),
LUA_TBOOLEAN), lua_toboolean(L, (n))
#define luaL_checkfunction(L,n) (luaL_checktype(L, (n),
LUA_TFUNCTION), lua_tocfunction(L, (n))