lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Defining LUA_CORE before including lua files helped, thanks!

Peter

2013/7/12 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> On Fri, Jul 12, 2013 at 5:05 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> > 2013/7/12 lua 4web <lua4web@gmail.com>:
>> >
>> >> This is strange considering my_gettop is a copy of lua_gettop.
>> >> I have noticed a pattern in seemingly random numbers produced by
>> >> my_gettop(i.e. 1431655765 = 0x55555555), but I have no idea why it
>> >> produces them instead of correct results.
>> >>
>> >> I'm sure I've made a simple mistake somewhere, can anybody help me find it?
>> >
>> > Your code works on the current version 5.2.2 on my system.
>> >
>>
>> I suspect that within the Lua core, TValue is defined to be an 8-byte
>> NaN packed value, whereas in your test.c, TValue is defined to be a
>> 16-byte structure.
>>
>> In a 64-bit environment, TValue is a 16-byte structure within the Lua
>> core, so the code will only break in a 32-bit environment.
>
> You have to define LUA_CORE in any file that uses Lua internals. (Some
> #defines in luaconf.h only work inside Lua core.)
>
> -- Roberto
>