[DiscordArchive] is that one of those things that you can duplicate if needed ?
[DiscordArchive] is that one of those things that you can duplicate if needed ?
Archived author: Foe • Posted: 2024-03-09T19:23:37.021000+00:00
Original source
I have some documentation how to do it, one sec
ata():Set("foo", { 111,222,333 }) -- save a table
ata():Set("foo", 2, nil) -- delete a key from the table
ata():Get("foo", 3)) -- Read data
ata():Get("foo") -- Can store the subtable into local variable also
ata():Set("bar"))Archived author: Foe • Posted: 2024-03-09T19:25:28.231000+00:00
Original source
```Lua
player
ata():Set("foo", { 111,222,333 }) -- save a table
player
ata():Set("foo", 2, nil) -- delete a key from the table
print(player
ata():Get("foo", 3)) -- Read data
local data = player
ata():Get("foo") -- Can store the subtable into local variable also
for k,v in pairs(data:AsLua(1)) do print(k,v) end -- convert one layer of a potentially nested table into lua table/data and iterate through it to print contents
-- You can refer to same C table from multiple places and set values to it
data:Set("bar", 666)
print(data:Get("bar") == player
ata():Set("bar"))
LuaVal.new({1,2,3}) -- one can create a new C data structure that is detached from a player if they want```
Archived author: Foe • Posted: 2024-03-09T19:26:27.500000+00:00
Original source
if you use AsLua then you fetch it as a Lua table
Archived author: Foe • Posted: 2024-03-09T19:26:41.505000+00:00
Original source
And then you can use it that way
Archived author: Tea • Posted: 2024-03-09T19:26:50.902000+00:00
Original source
i see AsTable in c++ tho, not AsLua
Archived author: Tea • Posted: 2024-03-09T19:26:55.863000+00:00
Original source
on the metatable
Archived author: Foe • Posted: 2024-03-09T19:26:59.898000+00:00
Original source
Oh, maybe I renamed it
Archived author: Foe • Posted: 2024-03-09T19:27:03.861000+00:00
Original source
Let me check
Archived author: Foe • Posted: 2024-03-09T19:28:02.960000+00:00
Original source
lua_pushcfunction(L, &LuaVal::lua_asLua);
lua_setfield(L, -2, "AsTable");
Yep
Archived author: Tea • Posted: 2024-03-09T19:28:07.937000+00:00
Original source
yeah, AsTable works