摘要: 我是一名C++程序员,所以在很多时候,不想过多的使用Lua的特性,因为个人感觉,Lua的语法要比C++的更加灵活。而我更希望,在函数调用的某些习惯上,遵循一些C++的规则。好了,废话少说,我们先来看一个类(头文件)。假设我们要把这个对象,传输给Lua进行调用。#ifndef _TEST_H#define _TEST_Hclass CTest{public: CTest(void); ~CTest(void); char* GetData(); void SetData(const char* pData);private: char m_szData[200];};#endif这个类... 阅读全文
posted @ 2013-07-12 20:55 全绍辉 阅读(385) 评论(0) 推荐(0) 编辑
摘要: lua_gettablelua_getglobal(L, "mytable") <== push mytablelua_pushnumber(L, 1) <== push key 1lua_gettable(L, -2) <== pop key 1, push mytable[1]lua_settablelua_getglobal(L, "mytable") <== push mytablelua_pushnumber(L, 1) <== push key 1lua_pushstring(L, "abc" 阅读全文
posted @ 2013-07-12 11:38 全绍辉 阅读(1294) 评论(0) 推荐(0) 编辑