码迷,mamicode.com
首页 > 编程语言 > 详细

lua调用C++

时间:2020-05-22 14:26:29      阅读:58      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!