lua-users home
lua-l archive

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


Wherever you got your lua.exe from, you would need to get a luac.exe from the same place with the options you want.

Since Lua bytecode isn't guaranteed to be compatible across releases, platforms, or build configurations, it's up to whoever builds the binaries (ie whoever creates the lua.exe) to define what bitness (and other configs) they use. Because there are no compatibility guarantees, there generally isn't any point compiling to bytecode unless you're working on a project where you tightly control the versions, toolchains and bitness (not to mention luaconf.h options, endianness, target architecture etc etc). I don't think I've ever used luac except when I've build Lua myself from source.

For example, you could quite easily build a x86_64 luac.exe which had 32-bit lua_Integer and 32-bit lua_Number, and the bytecode it produced would not be compatible with an x86 (32-bit) lua.exe built with the same options. At least, that's my recollection from the last time I tried it.

So it really does depend on what you are planning to do with the bytecode you're planning to create. For example, if the goal is "I want bytecode that's compatible with the 32-bit Windows LuaBinaries v5.4.2 lua.exe" then the only reliable solution is to use the luac.exe that's part of the 32-bit Windows v5.4.2 LuaBinaries release.

Last time I looked LuaBinaries releases included both lua.exe and luac.exe in both 64-bit and 32-bit configurations - see for example https://sourceforge.net/projects/luabinaries/files/5.4.2/Tools%20Executables/

Regards,

Tom

> On 29 Sep 2023, at 11:04, bil til <biltil52@gmail.com> wrote:
> 
> Hi,
> is there a luac54.exe available anywhere, which I can use to create
> 32bit Lua code on a larger system (e. g. Windows64)?
> 
> Or should I compile luac.c to get luac54.exe myself?
> 
> (Is this complicated or very extraordinary to create such a version of
> luac.exe to create 32bit LUA CODE? - I am bit surprised that Luac54
> does not offer some option 'i32' or similar to do this automatically
> (as LUA_32BITS is a very basic setting in luaconf.h).