|
@@ -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
|
|
|
** 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) {
|
|
|
luaL_checktype(L, 1, LUA_TTABLE);
|
|
|
luaL_checkany(L, 2);
|
|
@@ -447,6 +456,7 @@ static const luaL_Reg base_funcs[] = {
|
|
|
{"pcall", luaB_pcall},
|
|
|
{"print", luaB_print},
|
|
|
{"rawequal", luaB_rawequal},
|
|
|
+ {"rawlen", luaB_rawlen},
|
|
|
{"rawget", luaB_rawget},
|
|
|
{"rawset", luaB_rawset},
|
|
|
{"select", luaB_select},
|