pioneerspacesim/pioneer — pull request #1730 by robn (2012-11-18 03:05:17+00:00)
Title: Make CheckFromLua & GetFromLua consistent wiith Lua itself

Since the begin, `LuaObject` has had `CheckFromLua` and `GetFromLua` which do the opposite of Lua's own `luaL_check*` and `lua_to*`. Check is supposed to throw on error, while Get should return 0 on error. Instead, it was the other way around.

The core Lua wrapper classes did the right thing, using Get when they wanted checking. The new UI code was written later, and does Check, which leads to crashes pr failed assertions when data passed from Lua is wrong.

This swaps Check and Get in `LuaObject`, and swaps all calls in the core wrapper classes. UI classes have been left as they were, and now throw Lua errors correctly.

Doesn't changed `LuaFixed`, `LuaVector` or `LuaMatrix` which provide the same interface but don't go through `LuaObject`, and were correct from the start.

Not extensively tested, just a few minutes at max timeaccel, but it seems to be fine.