This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
immibis's profile picture

LiL - completely pointless Lua interpreter written in Lua

Started by immibis, 27 May 2012 - 06:43 AM
immibis #1
Posted 27 May 2012 - 08:43 AM
This is not finished (and unlikely to be), over 2500 lines long, very slow, and incredibly pointless. I just decided to post it here since it was obvious it wasn't going to be finished - the intention was to add debugging features that can't be done in normal CC Lua because of the lack of the debug library. But it's a Lua interpreter in Lua. (HAYO!)

Code: http://pastebin.com/3wLkBV40

Run it, and… you enter Luaception level 1, and get returned to another shell that's exactly the same as the one you were just in but a lot slower, because it's being interpreted.

It runs adventure fine, but can't run itself - it seems there might be a limit on the length of string a pattern will match, or something (it stops tokenizing itself at around the point where the BIOS code is)

Do whatever you want with this, if you can understand the code! Some ideas:
* Some sort of debugging interface, to debug the code running in it. This has full access to that code and can affect things like the string metatable and local variables, unlike normal Lua.
* Find and fix the bug that stops it from tokenizing itself, so you can have more levels of Luaception.
Lyqyd #2
Posted 27 May 2012 - 05:30 PM
"HAYO" makes you look like an idiot.

loadstring().
Cloudy #3
Posted 27 May 2012 - 07:07 PM
You really think he has no idea that loadstring() exists?

loadstring() wouldn't get round the debug library being disabled.

Nice work immibis - pointless like you said, but nice work nonetheless!
Noodle #4
Posted 28 May 2012 - 05:45 AM
This is pointless. Why?
Meh. Practice makes perfect!
immibis #5
Posted 30 May 2012 - 04:13 AM
= post deleted =