33 posts
Posted 11 December 2014 - 05:09 PM
Hello, again. I was just thinking back to my old days in Python, where I had come up with the idea of making a DE for Ubuntu GNU/Linux completely in Python, and I thought "Can this be done with Lua?". So, I was wondering if it would be possible to use the Paintutils API from Computercraft to do this. Obviously, this means that the Paintutils API would have to support different screen resolutions, different fonts, different font sizes, and, most importantly, the ability to run outside of minecraft. Is this possible? Also, if it's impossible, is there an API for lua similar to Paintutils that I could use to do this?
Also, If it is possible, would it be then further possible to port ComputerCraft OSes to Lua x86?
Thank you.
Edited on 11 December 2014 - 04:11 PM
7083 posts
Location
Tasmania (AU)
Posted 11 December 2014 - 09:34 PM
Paintutils is basically a simple little collection of convenience functions for working with the
term API. Since there's no term API in regular Lua setups, paintutils won't work outside of ComputerCraft.
However, I imagine that depending on the setup, there'll typically be something
similar to term. You'd need to research which commands in "Lua x86" match those in ComputerCraft's adaption of LuaJ (Lua 5.1), then work from there.
13 posts
Posted 11 December 2014 - 11:40 PM
Porting for a development environment would be quite possible, though you'd need some sort of emulation layer to simulate the various APIs that CC utilizes. Term being a good example, the other would be the event system (which isn't native to Lua itself).
I've actually briefly thought about testing my CC Lua code completely offline in such a manner, too. (I do it piecemeal at the moment, but I'd like to see my program run from start to finish.)
One way to do this would be to use some rendering engine with built-in Lua, such as Love2D, then write simulators for various CC API functions in said engine. Even a 2D visualization of a turtle moving around or rendered text would help immensely for developing/debugging turtle and UI code..
There would be differences with a different Lua implementation (ie: native C Lua and the LuaJ) but I don't think it would be all that noticeable, considering how simple Lua itself is (as a a language).
33 posts
Posted 12 December 2014 - 02:26 AM
Thank you both for the answers. I kinda figured I wouldn't be able to do this, but after some research I found out about curses (or more formally, lcurses) and that seems to be able to serve as a replacement for paintutils. Now all I have to do is find something to replace term, or maybe find someone smart enough to make a similar API for me. Well, until then, I guess I'm stuck with learning the rest of Lua so I can implement things to replace the event system and other particularly important functions.