-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Labels
Description
I have finally nailed down the actual situation that is causing a breaking change in my scripts. I apologize for two previous long-winded issues that were wrong (and now closed).
Consider this class and its registration:
class foo
{
public:
foo() {}
const char * nullconst() { return nullptr; }
char * null() { return nullptr; }
void twochars (const char* one, const char* two = nullptr)
{
std::string one_two = one;
if (two) one_two += " another parameter was provided: " + two;
}
};
luabridge::getGlobalNamespace(L)
.beginNamespace("foobar")
.beginClass<foo>("foo")
.addConstructor<void(*)(void)>()
.addFunction("nullconst", &foo::nullconst)
.addFunction("null", &foo::null)
.addFunction("twochars", &foo::twochars)
.endClass()
.endNamespace();Now consider the following Lua:
local foo = foobar.foo()
local nullconst = foo:nullconst() -- nullconst comes back nil on LB2 but "" on LB3: this is a breaking change
local null = foo:null() -- null doesn't come back. system goes >>BOOM<< on both LB2 and LB3See comments. My opinion is that both local variables nullconst and null should be nil after this code runs.