Doggynub
LUA / C++
- Joined
- Sep 28, 2008
- Messages
- 2,541
- Reaction score
- 186
okay i need to have this table in lua
I want to make it like that with the lua api
i have a std:: map like that :
[cpp]
std::map<std::string,int> status;
status["equip"] = int;
status["depot"] = int;
status["hold"] = int;
status["slot"] = int;
[/cpp]
Now in the c++ this supposed to be a argument in a function in creatureevent, so how to make it the proper way i have it like that
[cpp]
lua_newtable(L);
LuaInterface::setField(L,"equip",(int32_t)status["equip"]);
LuaInterface::setField(L,"hold", (int32_t)status["hold"]);
LuaInterface::setField(L,"depot",(int32_t)status["depot"]);
LuaInterface::setField(L,"slot", (int32_t)status["slot"]);
[/cpp]
and i get that error in console when the event supposed to be executed
LUA:
local status = { equip = int , hold= int, depot = int, slot= int)
I want to make it like that with the lua api
i have a std:: map like that :
[cpp]
std::map<std::string,int> status;
status["equip"] = int;
status["depot"] = int;
status["hold"] = int;
status["slot"] = int;
[/cpp]
Now in the c++ this supposed to be a argument in a function in creatureevent, so how to make it the proper way i have it like that
[cpp]
lua_newtable(L);
LuaInterface::setField(L,"equip",(int32_t)status["equip"]);
LuaInterface::setField(L,"hold", (int32_t)status["hold"]);
LuaInterface::setField(L,"depot",(int32_t)status["depot"]);
LuaInterface::setField(L,"slot", (int32_t)status["slot"]);
[/cpp]
and i get that error in console when the event supposed to be executed
Code:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/move.lua:onMoveItem
Description:
attempt to call a number value
stack traceback:
Last edited: