Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarLua.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-20 15:00:59 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-20 15:00:59 +1000
commitc1ae23808677028ef6ac1b7f0b19b298d78affc2 (patch)
tree0310c9d5e4673ea49add9791713fdd83b81ed87f /source/core/StarLua.cpp
parent9d66acde2ae6896607da953e20ba5bbfc23948f6 (diff)
parent043db1841ee46ace0f6919bfdf6ac20a539faaca (diff)
Merge branch 'voice'
Diffstat (limited to 'source/core/StarLua.cpp')
-rw-r--r--source/core/StarLua.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/core/StarLua.cpp b/source/core/StarLua.cpp
index 4e89097..287bf5c 100644
--- a/source/core/StarLua.cpp
+++ b/source/core/StarLua.cpp
@@ -1095,6 +1095,17 @@ LuaFunction LuaEngine::createRawFunction(lua_CFunction function) {
return LuaFunction(LuaDetail::LuaHandle(RefPtr<LuaEngine>(this), popHandle(m_state)));
}
+LuaFunction LuaEngine::createFunctionFromSource(int handleIndex, char const* contents, size_t size, char const* name) {
+ lua_checkstack(m_state, 2);
+
+ handleError(m_state, luaL_loadbuffer(m_state, contents, size, name));
+
+ pushHandle(m_state, handleIndex);
+ lua_setupvalue(m_state, -2, 1);
+
+ return LuaFunction(LuaDetail::LuaHandle(RefPtr<LuaEngine>(this), popHandle(m_state)));
+}
+
void LuaEngine::pushLuaValue(lua_State* state, LuaValue const& luaValue) {
lua_checkstack(state, 1);