| 845 | |
| 846 | |
| 847 | static void createmetatable (lua_State *L) { |
| 848 | lua_createtable(L, 0, 1); /* create metatable for strings */ |
| 849 | lua_pushliteral(L, ""); /* dummy string */ |
| 850 | lua_pushvalue(L, -2); |
| 851 | lua_setmetatable(L, -2); /* set string metatable */ |
| 852 | lua_pop(L, 1); /* pop dummy string */ |
| 853 | lua_pushvalue(L, -2); /* string library... */ |
| 854 | lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ |
| 855 | lua_pop(L, 1); /* pop metatable */ |
| 856 | } |
| 857 | |
| 858 | |
| 859 | /* |
no test coverage detected