简体   繁体   中英

Running Lua code on Android

I have a simple GUI program that has 2 text fields for number entry and a button to press to get sum of these numbers. It uses the portable IUP for GUI elements:

require( "iuplua" )

t1 = iup.text{}
t2 = iup.text{}
btn = iup.button {title = "SUM:"}
qbtn = iup.button{title="Quit"}
reslab = iup.label{}

function btn:action()
    v1 = tonumber(t1.value)
    v2 = tonumber(t2.value)
    resstr = string.format("%d", (v1 + v2))
    reslab.title = resstr
    dlg:show()
end
function qbtn:action()
    os.exit()
    end

dlg = iup.dialog {
 iup.vbox{
    iup.hbox{
        iup.label{title="First:"},
        t1  },
    iup.hbox{
        iup.label{title="Second:"},
        t2  },
    iup.hbox{
        btn,
        reslab  },
    iup.hbox{
        iup.label{},
        qbtn,
        iup.label{} } }, 
 title = "BMI"}

dlg:show()
iup.MainLoop() 

How can I run this simple program in Android? I am not able to find IUP guidance for Android. Does it needs to be rewritten with some other GUI library? Which one(s) is/are good? Thanks for your help.

For now, there is no IUP for Android. There is a prototype, as seen in the last Lua Workshop (2017) but it is not ready yet. Sorry I don't have any recommendations I'm not an Android developer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM