0

I am new to Lua. I have ported Lua 5.2 to another platform. I am able to run Lua scripts. But have a problem with loading modules.
I have a sample.lua script below. In this script I am trying to call a function available in another Lua script using the require function. The require function fails at lua_load() with LUA_ERRSYNTAX. Not sure if this is problem with Lua 5.2 version.

sample.lua

require"module"

welcome()

module.lua

function welcome()
    print(" Hello in module")
end

The require function in sample.lua file locates the module.lua file but fails at lua_load(). Can anyone help me with this issue ?

ComicSansMS
  • 51,484
  • 14
  • 155
  • 166
  • 2
    `lua_load` pushes an error message on the stack in case of failures. Are you able to retrieve that message? – ComicSansMS Jun 20 '13 at 09:18
  • 1
    What do you mean by *ported*? Lua should compile unmodified in all platforms that have an ANSI C compiler. – lhf Jun 20 '13 at 10:55
  • lhf - I might be wrong here in when i mean ported. I ment i have lua5.2 working a device which runs on different OS – user2504302 Jun 21 '13 at 10:30
  • ComicSansMS- It provides me module.lua:1: unexpected symbol near char(195). I really dont understand the meaning of this – user2504302 Jun 21 '13 at 10:41

1 Answers1

0

Could You be more specific about those different OS'es? Firstly, You should compile Lua for exactly the same OS and device Your are running *.lua scripts on. Secondly, You should check module.lua for some weird typos and invisible symbols. String.char(195) doesn't seem very visible. Also, could You check the enconding of that/those two Lua scripts?

Kamiccolo
  • 7,758
  • 3
  • 34
  • 47
  • the OS is threadX. I have few lua scripts that run over the same OS. I have compiled the module.lua and found no errors. Can you let me know How to check encoding of lua scripts ? – user2504302 Jun 27 '13 at 08:20