Changeset 490 for trunk/src/lua/lua_raw.cc
- Timestamp:
- 03/08/16 13:19:59 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_raw.cc
r449 r490 38 38 void nlua_pushreversed( lua_State *L, int index ) 39 39 { 40 index = lua_absindex( L, index );41 int len = static_cast<int>( lua_rawlen( L, index ) );40 index = nlua_absindex( L, index ); 41 int len = static_cast<int>( nlua_rawlen( L, index ) ); 42 42 int i = len; 43 43 lua_createtable( L, len, 0 ); … … 53 53 void nlua_shallowcopy( lua_State *L, int index ) 54 54 { 55 index = lua_absindex( L, index );55 index = nlua_absindex( L, index ); 56 56 lua_createtable( L, 0, 0 ); 57 57 lua_pushnil( L ); … … 67 67 void nlua_shallowicopy( lua_State *L, int index ) 68 68 { 69 index = lua_absindex( L, index );69 index = nlua_absindex( L, index ); 70 70 lua_createtable( L, 0, 0 ); 71 71 int i = 0; … … 85 85 void nlua_shallowmerge( lua_State *L, int index ) 86 86 { 87 index = lua_absindex( L, index );87 index = nlua_absindex( L, index ); 88 88 lua_pushnil( L ); 89 89 … … 98 98 void nlua_deepcopy( lua_State *L, int index ) 99 99 { 100 index = lua_absindex( L, index );100 index = nlua_absindex( L, index ); 101 101 lua_createtable( L, 0, 0 ); 102 102 lua_pushnil( L ); … … 118 118 void nlua_toset( lua_State *L, int index ) 119 119 { 120 index = lua_absindex( L, index );120 index = nlua_absindex( L, index ); 121 121 lua_createtable( L, 0, 0 ); 122 122 int i = 0; … … 137 137 void nlua_tokeyset( lua_State *L, int index ) 138 138 { 139 index = lua_absindex( L, index );139 index = nlua_absindex( L, index ); 140 140 lua_createtable( L, 0, 0 ); 141 141 lua_pushnil( L ); … … 151 151 void nlua_register( lua_State *L, const char* fname, lua_CFunction func, int index ) 152 152 { 153 index = lua_absindex( L, index );153 index = nlua_absindex( L, index ); 154 154 lua_pushstring( L, fname ); 155 155 lua_pushcfunction( L, func ); … … 159 159 void nlua_register( lua_State *L, const luaL_Reg *l, int index ) 160 160 { 161 index = lua_absindex( L, index );161 index = nlua_absindex( L, index ); 162 162 for (; l->name != NULL; l++) 163 163 { … … 200 200 void nlua_toflags( lua_State *L, int index, nv::uint8* data, nv::uint32 count ) 201 201 { 202 index = lua_absindex( L, index );202 index = nlua_absindex( L, index ); 203 203 nv::uint32 flag; 204 204 if ( lua_istable( L, index ) ) … … 222 222 void nlua_toflags_set( lua_State *L, int index, nv::uint8* data, nv::uint32 count ) 223 223 { 224 index = lua_absindex( L, index );224 index = nlua_absindex( L, index ); 225 225 nv::uint32 flag; 226 226 if ( lua_istable( L, index ) ) … … 241 241 void nlua_toflags_array( lua_State *L, int index, nv::uint8* data, nv::uint32 count ) 242 242 { 243 index = lua_absindex( L, index );243 index = nlua_absindex( L, index ); 244 244 nv::uint32 flag; 245 245 if ( lua_istable( L, index ) ) … … 260 260 nv::vector<nv::uint8> nlua_tobytearray( lua_State *L, int index ) 261 261 { 262 index = lua_absindex( L, index );262 index = nlua_absindex( L, index ); 263 263 nv::vector<nv::uint8> result; 264 264 if ( lua_istable( L, index ) ) … … 273 273 return result; 274 274 } 275 276 void * nlua_testudata( lua_State *L, int ud, const char *tname ) 277 { 278 void *p = lua_touserdata( L, ud ); 279 if ( p != NULL ) 280 { 281 if ( lua_getmetatable( L, ud ) ) 282 { 283 luaL_getmetatable( L, tname ); 284 if ( !lua_rawequal( L, -1, -2 ) ) 285 p = NULL; 286 lua_pop( L, 2 ); 287 return p; 288 } 289 } 290 return NULL; 291 } 292 293 void nlua_setmetatable( lua_State *L, const char *tname ) 294 { 295 int only_works_for_51; 296 luaL_getmetatable( L, tname ); 297 lua_setmetatable( L, -2 ); 298 } 299 300 void nlua_requiref( lua_State *L, const char *modname, lua_CFunction openf, int glb ) 301 { 302 int only_works_for_51; 303 lua_pushcfunction( L, openf ); 304 lua_pushstring( L, modname ); 305 lua_call( L, 1, 1 ); 306 if ( glb != 0 ) 307 { 308 lua_pushvalue( L, LUA_GLOBALSINDEX ); 309 lua_pushvalue( L, -2 ); 310 lua_setfield( L, -2, modname ); 311 lua_pop( L, 1 ); 312 } 313 } 314 315 int nlua_rawlen( lua_State* L, int index ) 316 { 317 return lua_objlen( L, index ); 318 } 319 320 void nlua_pushglobaltable( lua_State* L ) 321 { 322 int only_works_for_51; 323 lua_pushvalue( L, LUA_GLOBALSINDEX ); 324 }
Note: See TracChangeset
for help on using the changeset viewer.