testluacpp.cpp
来自「lua cpp 能和c++很好结合的一种脚本语言 体积小速度快」· C++ 代码 · 共 35 行
CPP
35 行
/** To build: g++ -o testLuacpp testLuacpp.cpp ../src/Interpreter.cpp \ -I ~/downloads/lua51/include -DHAVE_LUA51 -I ../src \ -L ~/downloads/lua51/bin/Win32 -llua51*/#include <iostream>using namespace std;#include "Interpreter.hpp"int main(){ lua::Interpreter lua; lua.doString("a=1; b=2; c=3; a,b,c = c,b,a"); try { lua.doFile("dontexist.lua"); assert( ! "file exists" ); } catch (const std::exception& exc) { cout << exc.what() << ": " << lua.errMsg() << endl; } lua.doFile("test.lua"); lua.doString("print(a,b,c)");}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?