Reputation: 1110
I'm trying to load a Lua
script into my project at runtime. However, whenever I try to do so, I receive the following error when loading the file:
Items\food.lua:1: unexpected symbol near '・
The file itself is simple enough, but I can't see the cause of this:
config = {
itemtype = 2,
name = "Food",
basevalue = 1,
inventorytexture = 0,
red = 255,
green = 255,
blue = 255,
inventorywidth = 1,
inventoryheight = 1
}
Here is the code that I am using to run this in C#
, in case this has anything to do with it:
// 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
}
I have tried changing the settings for the file itself, however none of these appear to help. Here are the settings that I have for this file:
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
Upvotes: 3
Views: 8641
Reputation: 23218
Looks like it could be a byte order mark. See: How do I remove the BOM character from my xml file and XML - Data At Root Level is Invalid
I've dealt with it in some XML files before, so I wouldn't be surprised if this is the same issue. As pointed out in some of the linked questions, there are utilities available to remove/avoid them easily as part of your workflow.
Upvotes: 2