I use OTCv8 for my small project.
I have a module for otclientv8 written in C++. The module generates numbers every second into a variable.
I would like to have access to this variable from lua to use this variable in a lua script.
I'm wondering and slowly eating my mustache on this code(my experience in c++ is small).
How to read a variable (c++) in lua code?
in the file
luavaluecasts_client.cpp
I added:
while in otclient, in modules, I created a sample module which should display the value 10. After opening the window.
What am I doing wrong that I don't have access to the variable from lua?
I have a module for otclientv8 written in C++. The module generates numbers every second into a variable.
I would like to have access to this variable from lua to use this variable in a lua script.
I'm wondering and slowly eating my mustache on this code(my experience in c++ is small).
How to read a variable (c++) in lua code?
in the file
luavaluecasts_client.cpp
I added:
C++:
int push_luavalue(const COM&Testdata)
{
g_lua.createTable(0, 1);
g_lua.pushInteger(10); // <--hardcoded value 10 - only for learnig only for learning purpose (imitates a variable)
g_lua.setField("testDatavalue");
return 1;
}
while in otclient, in modules, I created a sample module which should display the value 10. After opening the window.
Lua:
--window
function show()
tWindow:show()
if Testdata then
print("this is testdata: ", Testdata.testDatavalue)
end
print("Hello")
tButton:setOn(true)
end
What am I doing wrong that I don't have access to the variable from lua?
Last edited: