Skip to content

Commit

Permalink
WITCHER: Add CTlkTable GetSimpleString lua method
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius authored and DrMcCoy committed Nov 19, 2018
1 parent 04abc7b commit 4a7a506
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/engines/witcher/lua/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "src/aurora/lua/scriptman.h"
#include "src/aurora/lua/stack.h"
#include "src/aurora/lua/util.h"
#include "src/aurora/talkman.h"

#include "src/graphics/windowman.h"

Expand Down Expand Up @@ -619,6 +620,7 @@ void LuaBindings::CTlkTable::registerLuaBindings() {

LuaScriptMan.beginRegisterClass(getLuaType());
LuaScriptMan.registerFunction("GetTlkTable", &luaGetTlkTable);
LuaScriptMan.registerFunction("GetSimpleString", &luaGetSimpleString);
LuaScriptMan.endRegisterClass();

LuaScriptMan.endRegister();
Expand All @@ -635,6 +637,16 @@ int LuaBindings::CTlkTable::luaGetTlkTable(lua_State *state) {
return pushFakeObject(*state, getLuaType());
}

int LuaBindings::CTlkTable::luaGetSimpleString(lua_State *state) {
assert(state);

Aurora::Lua::Stack stack(*state);
unsigned int stringRef = stack.getIntAt(2);

stack.pushString(TalkMan.getString(stringRef));
return 1;
}

void LuaBindings::CAttackDefList::registerLuaBindings() {
LuaScriptMan.declareClass(getLuaType());

Expand Down
1 change: 1 addition & 0 deletions src/engines/witcher/lua/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class LuaBindings {

private:
static int luaGetTlkTable(lua_State *state);
static int luaGetSimpleString(lua_State *state);
};

class CAttackDefList {
Expand Down

0 comments on commit 4a7a506

Please sign in to comment.