|
* Lua Script [#e63fd751] -ページ: [[Request]] -投稿者: [[anonymous]] -優先順位: 低 -状態: 提案 -カテゴリー: -投稿日: 2013-03-23 (土) 10:24:12 -バージョン: ** メッセージ [#z061651f] Luaマクロを実行できるようにする。LuaからC++を呼び出す。 サクラエディタの全提供関数を登録するときに同一ハンドラを登録し、ハンドラで振り分けることができる。 func(){ lua_State* L = lua_newstate(); luaL_openlibs(L); //全提供関数を登録する lua_register(L, "S_XXXX", &Handler); ... int top = lua_gettop(L); if(lua_dostring(L, "SCRIPT CODE") != 0){ printf("%s\n", lua_tostring(L, -1)); lua_pop(L, 1); } lua_settop(L, top); lua_close(L); } int Handler(lua_State *L){ lua_Debug ar; lua_getstack(L, 0, &ar); lua_getinfo(L, "nsl", &ar); if(ar.name == NULL){ lua_pushstring(L, "error"); lua_error(L); return 0; } //関数名から処理を振り分ける ... return xxx; } ---- - マクロスクリプトエンジンをプラグインとして実装する方法はありませんか。 -- &new{2013-03-23 (土) 10:40:12}; #comment #attach |