Skip to content

Commit

Permalink
lua: Register globals in a more efficient way
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Oct 15, 2023
1 parent 9e8a69c commit 457b186
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Source/utils/lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ void LuaInitialize()
#endif

// Registering globals
lua["print"] = LuaPrint;
lua["_VERSION"] = LUA_VERSION;
lua.set(
"print", LuaPrint,
"_VERSION", LUA_VERSION);

// Registering devilutionx object table
sol::table devilutionx(lua, sol::create);
devilutionx["message"] = LuaPlayerMessage;
lua["devilutionx"] = devilutionx;
lua.create_named_table(
"devilutionx",
"message", LuaPlayerMessage);

RunScript("lua/init.lua");
RunScript("lua/user.lua");
Expand Down

0 comments on commit 457b186

Please sign in to comment.