简体   繁体   English

在 Android 上运行 Lua 代码

[英]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.我有一个简单的 GUI 程序,它有 2 个用于数字输入的文本字段和一个用于获取这些数字总和的按钮。 It uses the portable IUP for GUI elements:它为 GUI 元素使用便携式 IUP

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?如何在 Android 中运行这个简单的程序? I am not able to find IUP guidance for Android.我找不到适用于 Android 的 IUP 指南。 Does it needs to be rewritten with some other GUI library?它是否需要用其他一些 GUI 库重写? Which one(s) is/are good?哪些(哪些)是好的? Thanks for your help.谢谢你的帮助。

For now, there is no IUP for Android.目前,没有适用于 Android 的 IUP。 There is a prototype, as seen in the last Lua Workshop (2017) but it is not ready yet.有一个原型,如上次 Lua Workshop (2017) 中所见,但尚未准备就绪。 Sorry I don't have any recommendations I'm not an Android developer.抱歉,我没有任何建议,因为我不是 Android 开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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