lua调用C++

2021-01-15 12:12

阅读:899

标签:cal   get   生成   create   资料   pkg   ++   hello   creat   

根据pkg文件生成.h文件:
tolua++ -v
tolua++-1.0.92 (written by W. Celes, A. Manzur)
tolua++ -o L_CCObject.h CCObject.pkg
tolua++ -o L_CCString.h CCString.pkg

运行结果:
D:\hxh\bin\LUA资料\LUA\luatest\luatest>callTest toluatest.lua
8 3 4 9 8 0 5 1 3 0 7 4 2 1 9 0 3 6 1 6
你是:Ivan?

Lua代码:
--[[
mytest = CTest:new()
mytest:SetA(5)
mytest:SetB("Hello")
print(mytest:GetA())
print(mytest:GetB())
mytest:delete()
]]

for i=1,20 do
--local rnd = SIX_Utility:new():RNDNUM(0,9)
local rnd = SIX_Utility:GetInstance():RNDNUM(0,9)
io.write(rnd," ")
end

print();
local s = CCString:create("你是:".."Ivan?")
local s1 = SIX_Utility:GetInstance():U2G(s:getCString())
print(s1)

lua调用C++

标签:cal   get   生成   create   资料   pkg   ++   hello   creat   

原文地址:https://www.cnblogs.com/Ivanhan2019/p/12936867.html


评论


亲,登录后才可以留言!