Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil doesn't seem to work properly. #104

Open
TurkeyMan opened this issue Dec 3, 2016 · 2 comments
Open

nil doesn't seem to work properly. #104

TurkeyMan opened this issue Dec 3, 2016 · 2 comments

Comments

@TurkeyMan
Copy link
Contributor

LuaObject initialises to L=null, r = LUA_REFNIL. Then there's code:

@property bool isNil() pure nothrow @safe
	{
		return r == LUA_REFNIL;
	}

It looks like a nil object is treated as a lua nil... which makes sense to me... but then you try and copy it:

LuaObject x = LuaObject();
LuaObject y = x;

Crash, because L == null, and the function tries to push the value. Should there be a check in the postblit that inhibits this behaviour if the object is nil?

@JakobOvrum
Copy link
Owner

Should there be a check in the postblit that inhibits this behaviour if the object is nil?

Yeah, that sounds right. I wonder if there are other behaviours on nil that should be supported.

@TurkeyMan
Copy link
Contributor Author

This problem is everywhere... it'll be a big effort to smooth this over, otherwise I would have submit a patch ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants