Mason
Mason

Reputation: 51

How do I run a Lua script?

I'm running on windows 10. I built lua, added it to my environment variables PATH but I cant figure out how to successfully run it.

I tried dragging a .lua file onto lua.exe but that just causes my explorer window to freeze up and crash. I tried calling lua or my particular lua file in the command prompt but it does nothing - no error, just sits there with no output. I've tried moving files around, using the command prompt while in the same directory as the lua.exe but nothing is working.

EDIT: Here's a picture of my command prompt. from tutorials and videos I've seen, simply executing lua like that should allow me to instantly start typing commands.

Upvotes: 3

Views: 16740

Answers (4)

Athosworld
Athosworld

Reputation: 11

Open the code editor terminal and type lua filename.lua and that should run the program in the file.

Upvotes: 1

Alexander Herbert
Alexander Herbert

Reputation: 3

try using dofile("directory of the lua file you want to call ex. lualib/lua.lua") on your lua file. or if you want to run the script you can use repl.it

Upvotes: 0

clayton xia
clayton xia

Reputation: 1

if you just want to run simple lua script to get the result, you can get "code runner" from chrome extension store. you can run lua on it.furthermore, you can share or load code with others with it.

Upvotes: 0

Mason
Mason

Reputation: 51

Apparently renaming "Lua.exe" to "Lua53.exe" fixed the problem.

Upvotes: 2

Related Questions