mirror of https://github.com/rusefi/lua.git
new function 'rawlen'
This commit is contained in:
parent
868ff40339
commit
511679313f
12
lbaselib.c
12
lbaselib.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lbaselib.c,v 1.256 2010/12/17 15:14:58 roberto Exp roberto $
|
** $Id: lbaselib.c,v 1.257 2010/12/27 18:00:38 roberto Exp roberto $
|
||||||
** Basic library
|
** Basic library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -133,6 +133,15 @@ static int luaB_rawequal (lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int luaB_rawlen (lua_State *L) {
|
||||||
|
int t = lua_type(L, 1);
|
||||||
|
luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1,
|
||||||
|
"table or string expected");
|
||||||
|
lua_pushinteger(L, lua_rawlen(L, 1));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int luaB_rawget (lua_State *L) {
|
static int luaB_rawget (lua_State *L) {
|
||||||
luaL_checktype(L, 1, LUA_TTABLE);
|
luaL_checktype(L, 1, LUA_TTABLE);
|
||||||
luaL_checkany(L, 2);
|
luaL_checkany(L, 2);
|
||||||
|
@ -447,6 +456,7 @@ static const luaL_Reg base_funcs[] = {
|
||||||
{"pcall", luaB_pcall},
|
{"pcall", luaB_pcall},
|
||||||
{"print", luaB_print},
|
{"print", luaB_print},
|
||||||
{"rawequal", luaB_rawequal},
|
{"rawequal", luaB_rawequal},
|
||||||
|
{"rawlen", luaB_rawlen},
|
||||||
{"rawget", luaB_rawget},
|
{"rawget", luaB_rawget},
|
||||||
{"rawset", luaB_rawset},
|
{"rawset", luaB_rawset},
|
||||||
{"select", luaB_select},
|
{"select", luaB_select},
|
||||||
|
|
Loading…
Reference in New Issue