| 500 | |
| 501 | |
| 502 | LUAMOD_API int luaopen_base (lua_State *L) { |
| 503 | int i; |
| 504 | /* open lib into global table */ |
| 505 | lua_pushglobaltable(L); |
| 506 | luaL_setfuncs(L, base_funcs, 0); |
| 507 | /* set global _G */ |
| 508 | lua_pushvalue(L, -1); |
| 509 | lua_setfield(L, -2, "_G"); |
| 510 | /* set global _VERSION */ |
| 511 | lua_pushliteral(L, LUA_VERSION); |
| 512 | lua_setfield(L, -2, "_VERSION"); |
| 513 | /* set function 'type' with proper upvalues */ |
| 514 | for (i = 0; i < LUA_NUMTAGS; i++) /* push all type names as upvalues */ |
| 515 | lua_pushstring(L, lua_typename(L, i)); |
| 516 | lua_pushcclosure(L, luaB_type, LUA_NUMTAGS); |
| 517 | lua_setfield(L, -2, "type"); |
| 518 | return 1; |
| 519 | } |
| 520 |
nothing calls this directly
no test coverage detected