MCPcopy Create free account
hub / github.com/SOUI2/soui / SScriptModule_Lua

Method SScriptModule_Lua

components/ScriptModule-LUA/src/ScriptModule-Lua.cpp:81–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80
81 SScriptModule_Lua::SScriptModule_Lua()
82 {
83 d_state = luaL_newstate();
84 if(d_state)
85 {
86 luaL_openlibs(d_state);
87 SOUI_Export_Lua(d_state);
88 lua_register(d_state, "A2W", Utf8ToW);
89 lua_tinker::def(d_state, "cast_a2w", cast_a2w);
90 luaL_dostring(d_state,"function L (str)\n return cast_a2w(A2W(str));\nend");//注册一个全局的"L"函数,用来将utf8编码的字符串转换为WCHAR
91
92 lua_register(d_state, "A2T", Utf8ToT);
93 lua_tinker::def(d_state, "cast_a2t", cast_a2t);
94 luaL_dostring(d_state,"function T (str)\n return cast_a2t(A2T(str));\nend");//注册一个全局的"T"函数,用来将utf8编码的字符串转换为TCHAR
95 }
96 }
97
98
99 SScriptModule_Lua::~SScriptModule_Lua()

Callers

nothing calls this directly

Calls 4

luaL_newstateFunction · 0.85
luaL_openlibsFunction · 0.85
SOUI_Export_LuaFunction · 0.85
defFunction · 0.85

Tested by

no test coverage detected