我正在尝试Lua
在运行时将脚本加载到我的项目中。但是,每当我尝试这样做时,在加载文件时都会收到以下错误:
Items\food.lua:1: unexpected symbol near '・
文件本身很简单,但我看不出原因:
config = {
itemtype = 2,
name = "Food",
basevalue = 1,
inventorytexture = 0,
red = 255,
green = 255,
blue = 255,
inventorywidth = 1,
inventoryheight = 1
}
这是我用来运行它的代码,C#
以防这与它有关:
// In main initialisation
public void ItemSetup()
{
itemTemplates.Add(new ItemTemplate("Items\\food.lua"));
}
// constructor for ItemTemplate class
Lua LuaLoader = new Lua();
public ItemTemplate(string filename)
{
LuaLoader.DoFile(filename); // here is where the error comes up
}
我已经尝试更改文件本身的设置,但是这些似乎都没有帮助。以下是我对此文件的设置:
Build Action: None
Copy to Output Directory: Copy of newer
Custom Tool: <blank>
Custom Tool Namespace: <blank>
File Name: food.lua
Full Path: [...]\Items\food.lua