| 1781 | |
| 1782 | |
| 1783 | static void createmetatable (lua_State *L) { |
| 1784 | /* table to be metatable for strings */ |
| 1785 | luaL_newlibtable(L, stringmetamethods); |
| 1786 | luaL_setfuncs(L, stringmetamethods, 0); |
| 1787 | lua_pushliteral(L, ""); /* dummy string */ |
| 1788 | lua_pushvalue(L, -2); /* copy table */ |
| 1789 | lua_setmetatable(L, -2); /* set table as metatable for strings */ |
| 1790 | lua_pop(L, 1); /* pop dummy string */ |
| 1791 | lua_pushvalue(L, -2); /* get string library */ |
| 1792 | lua_setfield(L, -2, "__index"); /* metatable.__index = string */ |
| 1793 | lua_pop(L, 1); /* pop metatable */ |
| 1794 | } |
| 1795 | |
| 1796 | |
| 1797 | /* |
no test coverage detected