files with shebang fail to run
file:
#!/usr/bin/env lua
print "Hello"
Will fail at runtime, with syntax error in bundled source code.. Using #18 I can see the error is
[string "AOT Compiled module "test""]:1: unexpected symbol near '#'.
Removing the shebang fixes the issue.
Why is LUAOT_MODULE_SOURCE_CODE not precompiled with luac? It would fix the issue, unless theres a good reason its omitted. Im gonna try to see what precompiling would do...
Works great, slightly bigger binaries though (~10k?)
Why is LUAOT_MODULE_SOURCE_CODE not precompiled with luac?
No particular reason. Keeping it as Lua source was easy to implement.
Why is LUAOT_MODULE_SOURCE_CODE not precompiled with luac?
No particular reason. Keeping it as Lua source was easy to implement.
is keeping the lua source within the binary necessary? im not too familiar with how it works, but wouldnt you have a much smaller binary without it?
Lua has two kinds of function under the hood: C closures, and Lua closures. Counterintuitively, the luaaot functions are actually Lua closures. The easiest way to build those Lua Closure objects is to use loadstring to compile from source, or from bytecode.
Oh I see, thats intresting!