Hi there,
I'm trying to make a Lua plugin that counts the number of different animals I hunt on the mud I play. There are well over 100 of them so I thought I would try placing them all into a table.
I've run into a problem with loading the serialized table back during OnPluginInstall.
I get the error:
The two functions in question are:
The { in [string "{..."] is referring to the serialized variable, which is something like
which I found out using GetPluginVariable.
I'm trying to make a Lua plugin that counts the number of different animals I hunt on the mud I play. There are well over 100 of them so I thought I would try placing them all into a table.
I've run into a problem with loading the serialized table back during OnPluginInstall.
I get the error:
Description: [string "Plugin"]:147: [string "{..."]:1: unexpected symbol near '{'
stack traceback:
[C]: in function 'assert'
[string "Plugin"]:147: in function <[string "Plugin"]:145>
Called by: Function/Sub: OnPluginInstall called by Plugin Hunt_Counts
Reason: Executing plugin Hunt_Counts sub OnPluginInstall
The two functions in question are:
function OnPluginInstall ()
hunt={}
assert (loadstring (GetVariable ("hunt") or "")) ()
end -- OnPluginInstall
function OnPluginSaveState ()
require "serialize"
SetVariable ("hunt", serialize.save_simple (hunt))
end -- OnPluginSaveState
The { in [string "{..."] is referring to the serialized variable, which is something like
{
["Yellow Alligator"] = 1,
}
which I found out using GetPluginVariable.