| 77 | } |
| 78 | |
| 79 | void *check_udata(lua_State *L, int idx, const char *mt) { |
| 80 | void *p = lua_touserdata(L, idx); |
| 81 | if (!p) typerror(L, idx, mt); |
| 82 | if (!lua_getmetatable(L, idx)) typerror(L, idx, mt); |
| 83 | |
| 84 | lua_getfield(L, LUA_REGISTRYINDEX, mt); |
| 85 | if (!lua_rawequal(L, -1, -2)) typerror(L, idx, mt); |
| 86 | |
| 87 | lua_pop(L, 2); |
| 88 | return p; |
| 89 | } |
| 90 | |
| 91 | static int moon_line(lua_State *L, int lua_line, std::string const& file) { |
| 92 | if (luaL_dostring(L, "return require 'moonscript.line_tables'")) { |