diff options
| author | Alexander Gavrilov | 2012-04-05 11:59:39 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-04-05 11:59:39 +0400 |
| commit | 3afed43cdb435c788964d983a358d97ee291c2fc (patch) | |
| tree | 231d57551e1d9ff3ef8dedf7d29a265e23adf6ec /library/LuaWrapper.cpp | |
| parent | d1b27418a6a39aa15d51465e61975c5230dcc9d6 (diff) | |
| download | dfhack-3afed43cdb435c788964d983a358d97ee291c2fc.tar.gz dfhack-3afed43cdb435c788964d983a358d97ee291c2fc.tar.bz2 dfhack-3afed43cdb435c788964d983a358d97ee291c2fc.tar.xz | |
Experimental: try wrapping a dfhack api function.
Diffstat (limited to 'library/LuaWrapper.cpp')
| -rw-r--r-- | library/LuaWrapper.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/LuaWrapper.cpp b/library/LuaWrapper.cpp index 818e6b9e..2f3958ef 100644 --- a/library/LuaWrapper.cpp +++ b/library/LuaWrapper.cpp @@ -53,7 +53,10 @@ static luaL_Reg no_functions[] = { { NULL, NULL } }; */ void LuaWrapper::field_error(lua_State *state, int index, const char *err, const char *mode) { - lua_getfield(state, UPVAL_METATABLE, "__metatable"); + if (lua_islightuserdata(state, UPVAL_METATABLE)) + lua_pushstring(state, "(global)"); + else + lua_getfield(state, UPVAL_METATABLE, "__metatable"); const char *cname = lua_tostring(state, -1); const char *fname = index ? lua_tostring(state, index) : "*"; luaL_error(state, "Cannot %s field %s.%s: %s.", |
