Lua调用C++带参数的方法
来源:互联网 发布:app开发界面设计软件 编辑:程序博客网 时间:2024/05/17 15:39
C++代码:
// LuaAndC.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream> #include <string> using namespace std; extern "C" { #include "lua.h" #include "lauxlib.h" #include "lualib.h" } int sayHello(lua_State *L){string name=luaL_checkstring(L,-1);lua_pushnumber(L,name.length());return 1; //result count}int _tmain(int argc, _TCHAR* argv[]){ //1.创建一个state lua_State *L = luaL_newstate(); luaL_openlibs(L);lua_register(L,"sayHello",sayHello);luaL_dofile(L,"Hello.lua"); lua_close(L); int i;cin>>i; return 0 ; }
Lua代码:
print(sayHello("Hunter"))
0 0
- Lua调用C++带参数的方法
- 带参数的方法调用
- C#线程调用带参数的方法
- C#线程调用带参数的方法
- JS调用后台带参数的方法
- C#线程调用带参数的方法 ~
- JS调用后台带参数的方法
- PHP中带参数方法的调用
- JS调用后台带参数的方法
- JS调用后台带参数的方法
- C#线程调用带参数的方法 ~
- c# 调用带参数的js方法
- javascript调用后台带参数的方法
- C#线程调用带参数的方法
- C#线程调用带参数的方法
- C#线程调用带参数的方法
- JS调用后台带参数的方法
- 线程调用带参数的方法
- 使用screen 关闭终端 继续运行
- web项目出现import javax.servlet.……cannot be resolved的解决方法
- Apache HBase Region Splitting and Merging
- HYSBZ 2002 弹飞绵羊
- Qt 常用类 (6) —— QFont
- Lua调用C++带参数的方法
- 20150804-IAR For STM8工程改名
- hibernate的相关知识
- STM32定时器的编码器模式
- spark中的SparkContext实例的textFile使用的小技巧
- 如何安装配置Apache中的mod_security和mod_evasive
- c++ 结构体排序
- UIImageJPEGRepresentation和UIImagePNGRepresentation
- 读书笔记之c和指针(1)