摘要:
先看代码: 1 function permgen (a, n) 2 if 0 == n then 3 printResult(a) 4 else 5 for i=1,n do 6 a[n], a[i] = a[i], a[n] 7 permgen(a, n -1) 8 a[n], a[i] = a[i], a[n] 9 end10 end11 end12 13 function printResult (a)14 for i,v in ipairs(a) do15 ... 阅读全文
摘要:
首先配置环境,百度文库里这个讲的很详细http://wenku.baidu.com/view/7912da3667ec102de2bd8957.html环境配置好之后,我也写了个简单的调用main.cpp 1 #include <stdio.h> 2 3 extern "C"{ 4 #include "lua.h" 5 #include "lualib.h" 6 #include "lauxlib.h" 7 }; 8 9 10 lua_State *L;11 int luaAdd(int x, int 阅读全文