I'm having a really odd issue with a Lua implementation into my C++ project. For some reason, it doesn't allow scripts containing operators like #
, :
, %
(and some more, less important) to be executed.
In the results...
I need to use for i = 1, table.getn(tbl) do
instead of for i = 1, #tbl do
.
I need to use string.gsub(str, [..])
instead of str:gsub([..])
.
and so on... This is getting really annoying looking for a work-arounds.
My first thought was the encoding. I have tried with multiple common encodings though and none worked.
Errors I am having:
When using str:gsub([..])
instead of string.gsub(str, [..])
:
attempt to index global `str' (a string value)
When using #tbl
instead of table.getn(tbl)
:
unexpected symbol near `#'
What might be the problem? I will appreciate every solution because I am out of ideas.
Specifications:
Lua version:
#define LUA_VERSION "Lua 5.0.3"
C++ 11, FreeBSD 10