Skip to content

Need to make a Lua function having a NULL Host pointer throw an error rather than a nil + message #948

@SlySven

Description

@SlySven

We have fairly recently decided that a NULL Host pointer obtained by a function in TLuaInterpreter class should throw a Lua error like this:

Host* pHost = TLuaInterpreter::luaInterpreterMap[L];
if (!pHost) {
    lua_pushstring(L, "functionName: NULL Host pointer - something is wrong!");
    return lua_error(L);
}

however we still have quite a few that still have the previous response:

Host* pHost = TLuaInterpreter::luaInterpreterMap[L];
if (!pHost) {
    lua_pushnil(L);
    lua_pushstring(L, "functionName: NULL Host pointer - something is wrong!");
    return lua_error(L);
}

which need to be revised. Note that this does rely on the need for this check - which is mentioned in the related #947 ; should the check NOT be required than this issue is moot as the code would then be due for removal in either form...!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions