Various
This board is to host any non skyline related topics.

Lua Programming IDE

Lua Programming IDE

Postby Shando » 02 Sep 2017, 07:16

Hi all,

Just thought I'd let you know that ZeroBrane Studio (http://studio.zerobrane.com/) is a great open source app for testing Lua code. It obviously can't use Skyline specific functions, but great for pure Lua!

As an example, I wanted to write some code that extracted specific parts of the MAME xml file (120MB in size and crashed most of my desktop xml editors :(). I initially thought of using Python or C++ and decided that was probably overkill as it could be done so easily in Lua ;)

Here's the code that took me all of 10 minutes to write and works perfectly for what I needed:

Code: Select all
fh, err = io.open("mame.xml")

if err then print("Oops!")
    return
end

-- Open a file for write
fho, err = io.open("controls.xml","w")

-- line by line
while true do
    line = fh:read()
   
    if (line == nil) then
        break
    end
   
    if string.find(line, "<machine") or
      string.find(line, "<description") or
      string.find(line, "<control") or
      string.find(line,"<input") or
      string.find(line, "</input>") or
      string.find(line, "</machine") then
        fho:write(line)
        fho:write("\n")
    end
end

-- Following are good form
fh:close()
fho:close()


Basically, it reads in the xml file line by line, checks for certain tags and saves the lines with those tags to another file.

ZeroBrane runs on Windows, Mac & Linux, can use different versions of Lua (with debugging support for 5.1, 5,2 etc.) and is great for "live" coding.

Here's a quick feature list:

    Small, portable, open-source, and cross-platform (Windows, MacOS, and Linux);
    Auto-completion for functions, keywords, and custom APIs;
    Syntax highlighting and folding for 110+ languages and file formats;
    Project view with auto-refresh and ability to hide files and directories from the list;
    Interactive console to test Lua code snippets with local and remote execution;
    Integrated debugger with support for local and remote debugging, including cross-platform and on-device debugging;
    Live coding with Lua, LÖVE, Gideros, Moai, Corona, GSL-Shell and other Lua engines;
    50+ extension packages in the package repository;
    Fuzzy search for files, symbols, and library functions, function outline, and more.

So, if you're looking to write Lua "on-the-go" and don't need access to Skyline functions, this is a great little IDE that I highly recommend!

Hope this helps someone.

Shando

PS: Forgot to mention that as it's written in Lua, it can be extended in Lua as well!!!
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 442
Joined: 06 Mar 2013, 22:35
Location: Redland Bay, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Return to Various

Who is online

Users browsing this forum: No registered users and 1 guest