Page 1 of 1
Lua Port
Posted: Sat Dec 10, 2011 2:53 am
by severak
I have recently tested Lua port to KolibriOS.
I like lua so much, so I feel happy that I can use it on Kolibri. I want to port some of my old lua stuff, but I am missing one thing: console input. How can I manage (or emulate) this?
For example, code look like this:
Code: Select all
print("What is your name?")
name=io.read()
Re: Lua Port
Posted: Sat Dec 10, 2011 7:25 am
by SoUrcerer
Latest version doesn't create console window. Instead you should to create window and buttons, and check keyboard and screen events. If you need details, I'll write it here later:)
Also, if you really need console input and output, I'll try to add these functions to KOS port
Thnak you for your response!
Re: Lua Port
Posted: Sat Dec 10, 2011 12:53 pm
by severak
It would be nice to have textmode.
It will enable really fast porting of existing lua apps.
I will also play with play with nateve GUI, maybe there will be some nice app from me sometimes.
Re: Lua Port
Posted: Sat Dec 10, 2011 1:00 pm
by SoUrcerer
Okay! Now I have other plans, but I think I can add console input and output before Xmas.
You can't draw pictures from Lua in Native GUI yet, but I can add almost any function you want. Just write what you need

Also it'll be nice to add Lua Sockets, but there are no realization of POSIX sockets in Kolibri yet.
Re: Lua Port
Posted: Mon Dec 19, 2011 10:36 pm
by SoUrcerer
Hi,
severak! I updated port to 5.2.0 and added new commands:
copen() - create console window
cclose() - close console window
cprintf("string",value,anything,separated_by_commas) - print anything
val=cgets() - get string from keyboard
Link to download:
download/file.php?id=3105
Re: Lua Port
Posted: Sun Apr 08, 2012 12:34 am
by silver
It would be really nice to have some GUI support for Lua programs.
What about creating the bindings for the Kolibri API?
Re: Lua Port
Posted: Sun Apr 08, 2012 7:52 am
by SoUrcerer
Sorry, I didn't thought that somebody except me would need Lua

So, I'll translate some info from Lua topic (
viewtopic.php?f=45&t=1663&p=39354#p39354 )
Some language bindings:
Code: Select all
--console functions
copen() - open console
cclose() - close console
cprintf() - printf something
cgets() - get string
--window functions
paintstart() --begin window redraw
paintend() --finish window redraw
window(10,10,153,180,65069280) --create window
textout(3,13,0,"LuaCalc") --print text
makebutton(6,60,20,20,17,13619151) --create/delete button (take a look at KolibriOS system functions)
waitevent() --wait for event
checkevent() --check for event (take a look at sysfuncs too)
getkey() --get pressed key from keyboard
getbutton() --get code of pressed screen button
sysexit() --stop execution
systime() - get time (in BCD)
sysdate() --get date (in BCD)
drawpixel(x,y,c) --nuff said :)
drawline(x,y,x1,y1,c)
There are some examples in archive, btw.