bennyxqg / lua-alchemy

Automatically exported from code.google.com/p/lua-alchemy
0 stars 0 forks source link

Ensure Lua Alchemy's Lua bytecode dumps are not dependent on user machine endianness #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
save: local str = string.dump(function() return "BOO!" end)
load (on other-endian machine): assert(assert(loadstring(str))() == "BOO!")

Quote from Duncan Cross:

Should Lua bytecode generated by Lua Alchemy be compatible across all
browsers/platforms (to be run by another instance of Lua Alchemy), or are
there still possible endianness compatibility problems? I understand that
Lua's function dump relies on the endianness of the machine that's running
it on, making it nonportable. From what I know of ActionScript ByteArrays,
they do have an "endian" property for reading and writing various number
types, but what I don't know is whether this defaults to the native
endianness or has a fixed default, or whether this is even relevant in Lua
Alchemy's case.

Original issue reported on code.google.com by aglad...@gmail.com on 22 Dec 2008 at 1:23

GoogleCodeExporter commented 9 years ago

Original comment by aglad...@gmail.com on 22 Dec 2008 at 8:22

GoogleCodeExporter commented 9 years ago

Original comment by rstehw...@gmail.com on 5 Jan 2009 at 2:50

GoogleCodeExporter commented 9 years ago

Original comment by aglad...@gmail.com on 7 Feb 2009 at 9:08