Thalassicus
Bytes and Nibblers
I'm trying to learn how to use loadstring and dostring to execute code, but having difficulty understanding this part of the reference manual. I'm starting with a very simple operation:
local test = city:IsRazing();
I've tried replacing this operation (which works correctly) with each of the ones below, and all produce the generic nil error:
local test = dostring("return city:IsRazing()");
local test = dostring("city:IsRazing()");
local test = loadstring("return city:IsRazing()");
local test = loadstring("city:IsRazing()");
What's the correct syntax? I've also tried adding assertions and other things indicated in the reference manual.
The reason I ask is because if I understand correctly, either dostring or loadstring are how to implement an externally-stored jump table in Lua, which is what I need.
local test = city:IsRazing();
I've tried replacing this operation (which works correctly) with each of the ones below, and all produce the generic nil error:
local test = dostring("return city:IsRazing()");
local test = dostring("city:IsRazing()");
local test = loadstring("return city:IsRazing()");
local test = loadstring("city:IsRazing()");
What's the correct syntax? I've also tried adding assertions and other things indicated in the reference manual.
The reason I ask is because if I understand correctly, either dostring or loadstring are how to implement an externally-stored jump table in Lua, which is what I need.