Coder Social home page Coder Social logo

samyeyo / rtc Goto Github PK

View Code? Open in Web Editor NEW
53.0 4.0 4.0 69 KB

Lua script to executable compiler

Home Page: https://www.luart.org

License: MIT License

Lua 100.00%
lua compiler windows lua-script compilation executable exe standalone self-executable self-contained

rtc's Introduction

rtc

Made with LuaRT Windows Vista+ MIT License

Build standalone Windows executables from your Lua scripts.

Features | Installation | Usage | Documentation | Links | License

Features

  • Standalone tool : no Makefile, no C compiler needed
  • Compile from command line or using a GUI frontend
  • Build Windows native executable (.exe) from your Lua 5.4.6 scripts
  • Windows desktop or console applications
  • Static executables (without lua54.dll dependency)
  • Dynamic executables (with lua54.dll dependency)
  • Embed any files with your executable, even Lua binary modules with seamless loading using require()
  • Access embedded files seamlessly from your Lua scripts
  • Deploy your applications easily without the need to install Lua

Installation

Using latest release package

The easiest way to install is to download the latest binary release from the Github repository. Just add the directory where you have unpacked the release package to your Windows system PATH variable.

If you use the release package, you don't need any other dependencies to compile Lua scripts.

Build rtc

To build rtc, you will need to install the LuaRT programming framework sources before to proceed. Go to the src\ directory in the LuaRT folder and type "make rtc" in a command prompt. It should produce a "rtc.exe" and "wrtc.exe"executable.

Usage

rtc command line options

usage:	rtc.exe [-s][-c][-w][-i icon][-o output] [-lmodname] [directory] main.lua
	-s		create static executable (without LUA54.DLL dependency)
	-c		create executable for console (default)
	-w		create executable for Windows desktop
	-i icon		set executable icon (expects an .ico file)
	-o output	set executable name to 'output'
	-lmodname	link the LuaRT binary module 'modname.dll'
	directory	the content of the directory to be embedded in the executable
	main.lua   	the Lua script to be executed

The specified optional directory will then be embedded within the executable with all its content archived in the ZIP format, bundled with the generated executable. As an alternative, you can use wrtc.exe, the GUI frontend which is more usert friendly.

Warning Compiled dynamic executable depends on the provided lua54.dll library. Do not use any other library or your application will throw an error or may crash.

Accessing embedded files from your LuaRT application

To access embedded files from your LuaRT application, just use the global "embed" module. It will return a Zip instance, already open for read access, that contains the directory content provided on the command line during compilation with rtc :

-- extract all the embedded content
embed:extractall("c:/installdir/")

If no embedded content exists, "embed" will be set to a nil value. You should check that the current script is compiled embed table before using it. See the LuaRT Zip object documentation for more information.

Requiring Lua modules from embedded files

To require a LuaRT script file in the embedded files, use require with the name of the module. You can require Lua modules, and binary modules (DLL) without the need to extract first (please note that in-memory binary modules loading works only with dynamic executables and may not work for some modules).

-- require for the english.lua module, that must have been previously embedded with rtc 
local english = require "english"
print(english.hello)

Links

License

LuaRT and rtc are copyright (c) 2023 Samir Tine. rtc is open source, released under the MIT License. See full copyright notice in the LICENSE file.

rtc's People

Contributors

samyeyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rtc's Issues

Error in gui.lua on some display

The following error occurs on some display with high DPI
["gui.lua"]:35: in method 'Button.constructor' (number has no integer representation)

Compiled .exe is changing execution behaviour when .lua source files are changed, without recompilation.

I created a .exe using "rtc -s main.lua ." (static compilation, integrating the source files in the current directory into the .exe) resulting in main.exe. If the .lua source files in the directory are changed, the execution of main.exe changes to match the changes in the source files without recompiling the .exe.
If main.exe is moved into a different folder (so it is not in the same folder as the .lua source files) the execution behaviour reverts to the behaviour matching the source files at the time it was compiled.

Does not seem to be working?

Just downloaded and test it on a simple hello world lua script, it creates the .exe file but does not print hello world in the terminal when I run the .exe it made.

I basically did rtc hw.lua and it made hw.exe but nothing comes from it when executed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.