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