Hi,
I'm trying to work out how to serialize a lua table.
This table consists of booleans which are string named, like this.
gag.spells=true
gag.combat=true
These are options for spam filters which i want to save.
What I did was this:
On the PluginSaveState function I serialized the gag table like this
require "serialize"
local gags = serialize.save_simple(gag)
Then I put it into a variable
SetVariable("gag",gags)
So far so good, but when i try to load the table using OnPluginInstall,
gag={}
--local gags = GetVariable("gag")
--gag= assert(loadstring(gags))()
I get the following error:
Plugin: AlterAeon (called from world: alter)
Function/Sub: OnPluginInstall called by Plugin AlterAeon
Reason: Executing plugin AlterAeon sub OnPluginInstall
[string "Plugin"]:601: [string "{..."]:1: unexpected symbol near '{'
stack traceback:
[C]: in function 'assert'
[string "Plugin"]:601: in function 'clear'
I'm using the latest version of mush 4.66.
Thoughts?
Thanks!
I'm trying to work out how to serialize a lua table.
This table consists of booleans which are string named, like this.
gag.spells=true
gag.combat=true
These are options for spam filters which i want to save.
What I did was this:
On the PluginSaveState function I serialized the gag table like this
require "serialize"
local gags = serialize.save_simple(gag)
Then I put it into a variable
SetVariable("gag",gags)
So far so good, but when i try to load the table using OnPluginInstall,
gag={}
--local gags = GetVariable("gag")
--gag= assert(loadstring(gags))()
I get the following error:
Plugin: AlterAeon (called from world: alter)
Function/Sub: OnPluginInstall called by Plugin AlterAeon
Reason: Executing plugin AlterAeon sub OnPluginInstall
[string "Plugin"]:601: [string "{..."]:1: unexpected symbol near '{'
stack traceback:
[C]: in function 'assert'
[string "Plugin"]:601: in function 'clear'
I'm using the latest version of mush 4.66.
Thoughts?
Thanks!