| 1012 | |
| 1013 | |
| 1014 | static void createmetatable (lua_State *L) { |
| 1015 | lua_createtable(L, 0, 1); /* table to be metatable for strings */ |
| 1016 | lua_pushliteral(L, ""); /* dummy string */ |
| 1017 | lua_pushvalue(L, -2); /* copy table */ |
| 1018 | lua_setmetatable(L, -2); /* set table as metatable for strings */ |
| 1019 | lua_pop(L, 1); /* pop dummy string */ |
| 1020 | lua_pushvalue(L, -2); /* get string library */ |
| 1021 | lua_setfield(L, -2, "__index"); /* metatable.__index = string */ |
| 1022 | lua_pop(L, 1); /* pop metatable */ |
| 1023 | } |
| 1024 | |
| 1025 | |
| 1026 | /* |
no test coverage detected