Spawn Mob problem
#6
I've found the source of the bug. When generating the min and max I assumed we would only ever assign literal numbers to enum values, not other constexpr values. So when generating the range check it uses the tonumber of the text strings to generate the max. I'm not sure how to solve this because tolua does not have the awareness of the c++ code to solve this problem generally. To solve the problem generally would require a full c++ parser/type checker, due to templates and c++11 constexpr. (If you're willing to bundle/require clang and the rust runtime, I might write an alternative to tolua that can provide the general solution)

In the special case of using enum values in the global namespace where the enum values are exposed to the lua API, this could possibly be solved by having tolua lookup the values. This would involve exposing the E_META_SPAWNEGG enum values to lua, admittedly documented as not part of the API.

An alternate solution that would require more significant changes to tolua internally would be to implement the previous solution and also add a marker to allow tolua to parse an enum, but not to generate bindings for it. This would solve the special case of using enum values in the global namespace.
Reply
Thanks given by:


Messages In This Thread
Spawn Mob problem - by StevasaurousREX - 10-10-2014, 07:06 AM
RE: Spawn Mob problem - by xoft - 10-10-2014, 05:12 PM
RE: Spawn Mob problem - by VeryBlackMan - 12-17-2014, 03:56 AM
RE: Spawn Mob problem - by xoft - 12-17-2014, 04:18 AM
RE: Spawn Mob problem - by Howaner - 12-17-2014, 06:35 AM
RE: Spawn Mob problem - by worktycho - 12-18-2014, 11:02 AM
RE: Spawn Mob problem - by xoft - 12-18-2014, 10:24 PM
RE: Spawn Mob problem - by worktycho - 12-19-2014, 12:40 AM



Users browsing this thread: 1 Guest(s)