• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ [TFS 1.4] onLook: attempt to index local 'thing' (a nil value)

Ramon Bernardo

Well-Known Member
TFS Developer
Joined
Oct 7, 2018
Messages
137
Solutions
4
Reaction score
94
I dont understand why returning null.
Ive made a lot of changes to src and its been hard to track what i changed to give it this.
Lua Script Error: [Event Interface]
data/events/scripts/player.lua: Player@onLook
...data\scripts\eventcallbacks\player\default_onLook.lua:4: attempt to index local 'thing' (a nil value)
stack traceback:
[C]: in function '__index'
...data\scripts\eventcallbacks\player\default_onLook.lua:4: in function <...data\scripts\eventcallbacks\player\default_onLook.lua:3>
...data\scripts\lib\event_callbacks.lua:121: in function 'EventCallback'
data/events/scripts/player.lua:4: in function <data/events/scripts/player.lua:1>

Any suggestions where I should start? Im in this for a few hours...
 
Solution
For some reason, this error come from: luascript.cpp/luaTablePack
I added brackets in for loop and receiv error. Reason? I do not know.

old code
C++:
for (i = n; i >= 1; i--) /* assign elements */
        lua_rawseti(L, 1, i);
        if (luaL_callmeta(L, -1, "__index") != 0) {
            lua_replace(L, -2);
        }

new code, with error (only brackets added)
C++:
for (i = n; i >= 1; i--) { /* assign elements */
        lua_rawseti(L, 1, i);
        if (luaL_callmeta(L, -1, "__index") != 0) {
            lua_replace(L, -2);
        }
}
For some reason, this error come from: luascript.cpp/luaTablePack
I added brackets in for loop and receiv error. Reason? I do not know.

old code
C++:
for (i = n; i >= 1; i--) /* assign elements */
        lua_rawseti(L, 1, i);
        if (luaL_callmeta(L, -1, "__index") != 0) {
            lua_replace(L, -2);
        }

new code, with error (only brackets added)
C++:
for (i = n; i >= 1; i--) { /* assign elements */
        lua_rawseti(L, 1, i);
        if (luaL_callmeta(L, -1, "__index") != 0) {
            lua_replace(L, -2);
        }
}
 
Solution
Back
Top