lua "interpreter" in lua |
![]() ![]() « Citoyen » 1691575140000
| 4 | ||
![]() Recently wrote a lua lexer, parser and interpreter in lua for no reason. It has bad performance and might have some inaccurate behaviours, but wanted to share it anyway. Demo version can be found here: https://pastebin.com/yk1VmNbt (last update: 2023-08-10) Usage: !eval (snippet) in chat Globals are shared, locals are not. It would not be difficult to change the globals table for the module that is being run and I might add a parmaeter for it in a future update. Source code can be found on my GitHub: https://github.com/NathaanTFM/luainlua Errors are not handled: if there's any parse or runtime error, it might either be detected by the runtime ; in which case it will include additional debug info and line numbers, but for most cases (i.e errors with binary - arithmetic - operations), there won't be any debug info. (The demo version can be appended to any existing script and shouldn't break it. It also adds a "loadstring" global function. Usage: loadstring(code, chunkname, globals)) Changes: - added "repeat (...) until" loops (those were parsed but not interpreted) - fixed issue with commas at the end of functions (function() print("hello world"); end) - fixed long strings - fixed issue with argument passing (related to a LuaJ bug with table.pack and table.unpack) Dernière modification le 1691701620000 |
1 | ||
Nathaan a dit : complex, i like it congrats |