スクリプト>Lua
LuaSDL
http://tulrich.com/geekstuff/index.html
wxLua
http://www.luascript.thersgb.net/
http://www.gorlice.net.pl/~rybak/luaide/
Lua用開発環境 QDE version 0.6
Lua for Delphi
Calua
http://calua.sourceforge.net/
int errno; // (リンクエラー対策。errno.cppとして別ファイルにしておく。)
extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" } lua_State *L; L = lua_open(); luaopen_base(L); luaopen_string(L); luaopen_table(L); luaopen_math(L); luaopen_io(L); lua_register(L, "foo", do_foo); // fooというfunctionを登録 lua_dofile(L, "startup.lua"); // スクリプトを読み込んで実行 lua_dostring(L, "foo()"); // fooというfunctionを実行 lua_close(L);
// foo() static int do_foo(lua_State *L) { int n = lua_gettop(L); /* 引数の数 */ return 0; }
lua_getglobal(L, 変数名); // 変数名の値がスタックに積まれる int val = (int)lua_tonumber(L, -1); // スタックから取り出す