Re:Show HN: LuaJIT assembler/assembly language for direct by...
by SlowRobotAhead on Saturday November 09, 2019 @09:18PM
(#21495992)
Any examples of code or know where someone has done this?
[ Parent
| on HN ]
Re:Show HN: LuaJIT assembler/assembly language for direct by...
by matheusmoreira on Saturday November 09, 2019 @11:13PM
(#21496361)
Lua was made for this! Here's a simple example:
https://gist.github.com/Vesnica/3672425
It loads and runs a Lua source code file which calls the exported C function. Lua compiles the source code into byte code before running it but that can also be done ahead of time with the Lua compiler:
https://www.lua.org/manual/5.3/luac.html
It can also be done manually with the dump and load functions: