| 1562 | |
| 1563 | |
| 1564 | static void createmetatable (lua_State *L) { |
| 1565 | lua_createtable(L, 0, 1); /* table to be metatable for strings */ |
| 1566 | lua_pushliteral(L, ""); /* dummy string */ |
| 1567 | lua_pushvalue(L, -2); /* copy table */ |
| 1568 | lua_setmetatable(L, -2); /* set table as metatable for strings */ |
| 1569 | lua_pop(L, 1); /* pop dummy string */ |
| 1570 | lua_pushvalue(L, -2); /* get string library */ |
| 1571 | lua_setfield(L, -2, "__index"); /* metatable.__index = string */ |
| 1572 | lua_pop(L, 1); /* pop metatable */ |
| 1573 | } |
| 1574 | |
| 1575 | |
| 1576 | /* |
no test coverage detected