645 posts
Location
'Merica
Posted 13 April 2013 - 05:46 PM
Now I already now how to change the color of text in CC-Lua, but I know Lua is a little different. Well I'm making this "Personal Assistant" thingy on my iPod with a app called "TouchLua", and well it does what its title suggests, its my assistant, lol, well its written fully in regular Lua, not CC-Lua, but let me get to the real problem, so I wanted to know how you would mimic "term.setTextColor(colors.<a Color>)" into regular Lua. And "term.setCursorPos(<coords>)".
1190 posts
Location
RHIT
Posted 13 April 2013 - 06:55 PM
There is no such thing in regular Lua. Unless your app provides a way of GUI interaction then I am afraid you are stuck with a text-based system. There are several Lua GUI bindings such as wxLua for a full-blown installation of Lua on a computer (oftentimes they are operating system specific), but unfortunately I do not know of any for an IOS device; Implementation would probably be fiendishly difficult.
Edit: If the app does provide some sort of visual interaction, you will most likely be able to find it by cycling through the _G environment table like so:
for i,v in pairs(_G) do
print(i..": "..type(v))
end
You'll probably have to look through a lot of global variables/functions/tables, but hey you might find something useful in the process.
645 posts
Location
'Merica
Posted 13 April 2013 - 07:25 PM
There is no such thing in regular Lua. Unless your app provides a way of GUI interaction then I am afraid you are stuck with a text-based system. There are several Lua GUI bindings such as wxLua for a full-blown installation of Lua on a computer (oftentimes they are operating system specific), but unfortunately I do not know of any for an IOS device; Implementation would probably be fiendishly difficult.
Edit: If the app does provide some sort of visual interaction, you will most likely be able to find it by cycling through the _G environment table like so:
for i,v in pairs(_G) do
print(i..": "..type(v))
end
You'll probably have to look through a lot of global variables/functions/tables, but hey you might find something useful in the process.
Well thanks anyways.
537 posts
Location
Copenhagen, Denmark
Posted 13 April 2013 - 10:18 PM
iOS runs on Unix or something, IIRC, so you should be able to do something like this:
print("\033[31;0m<your text here>") -- Print some red text.
This is ANSI escape code, which works with basically everything except for the Windows commandline.
You can learn more about it here:
http://en.wikipedia.org/wiki/ANSI_escape_codeThe colour-range is very limited, though, unless you're using xterm-256, which supports full RGB text.