Watch 2 Star 7 Fork 1

tanhunu / luajit_aardioLibLua

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
luajit快手扩展库 spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

#Luajit扩展库 这个库是aauto与luajit相互调用的库。luajit的执行效率非常高。当碰到很需要效率的地方可以考虑用luajit来实现。

import luajit;
io.open()


luaCode = /*
print(add(5,6))
print(vars)
b = "这是lua里面的变量值"
function msgBox(msg,title,type)
    local ffi = require("ffi")
    ffi.cdef[[
        int MessageBoxA(void *w, const char *txt, const char *cap, int mtype);
    ]]
    ffi.C.MessageBoxA(nil, tostring(msg),tostring(title), mtype or 0)
end

function test( a,b )
    return a*b,a+b,a-b;
end

*/

print = function(...){
    io.print(...)
}
add = function(a,b){
    return a+b; 
}

lua = luajit(luaCode)
//运行前注册函数等等
lua.register("print",print)//注册函数
lua.register("add",add)//注册带返回值函数
lua.setValue("vars","这是aauto注册到lua的变量")//注册变量
lua.run()//运行脚本



//运行后操作
io.print(lua.getValue("b"))//取lua变量b值
msgBox = lua.getFunc("msgBox")//取lua函数
msgBox("弹出提示框","这里是标题")//执行函数
test = lua.getFunc("test",3)//取lua函数,返回值个数为3
io.print(test(5,2))
execute("pause")

Comments ( 0 )

Sign in for post a comment

Lua
1
https://gitee.com/tanhunu/luajit_aardioLib.git
git@gitee.com:tanhunu/luajit_aardioLib.git
tanhunu
luajit_aardioLib
luajit_aardioLib
master

Search