| 1793 | |
| 1794 | |
| 1795 | static void createmetatable (lua_State *L) { |
| 1796 | /* table to be metatable for strings */ |
| 1797 | luaL_newlibtable(L, stringmetamethods); |
| 1798 | luaL_setfuncs(L, stringmetamethods, 0); |
| 1799 | lua_pushliteral(L, ""); /* dummy string */ |
| 1800 | lua_pushvalue(L, -2); /* copy table */ |
| 1801 | lua_setmetatable(L, -2); /* set table as metatable for strings */ |
| 1802 | lua_pop(L, 1); /* pop dummy string */ |
| 1803 | lua_pushvalue(L, -2); /* get string library */ |
| 1804 | lua_setfield(L, -2, "__index"); /* metatable.__index = string */ |
| 1805 | lua_pop(L, 1); /* pop metatable */ |
| 1806 | } |
| 1807 | |
| 1808 | |
| 1809 | /* |
no test coverage detected