compiler construction - Lua crashes when programs are compiled -
i'm working on very, simple lua program, trying teach myself language. here's 3 line program:
file = io.open("hello.txt", "w") file:write("hello, world.\n") io.close(file)
when use program lua script, works fine. when compile program, works. however, when run compiled program, this:
alt text http://profnano.org/andy/misc/img/lua_crash.jpg
i'm using lua 5.1.2 on windows xp on pentium 4. uninstalled lua , re-installed it, no effect. i'm compiling script follows:
luac -o hello.exe hello.lua
am doing wrong, or known bug? i'd able write lua programs run on computers without lua installed. help! (and thanks!)
luac doesn't compile system exe file. take lua script, , turn lua bytecode. still have pass resulting file lua execute.
so exe file contains garbage os point of view. when exe files don't contain valid exe headers, os reason decides must old style dos .com file , tries execute 16bit dos subsystem. hence strange error message.
if want make exe out of compiled lua need use different environment - perhaps visual studio - make small project loads (and executes) lua file - compiled or script - using embedded lualib.
creating standalone lua executables on stackoverflow has tips on how go that.
Comments
Post a Comment