Giter Site home page Giter Site logo

watmough / maclua5.3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from solrabizna/maclua5.3

0.0 3.0 0.0 343 KB

Classic MacOS port of Lua 5.3, supporting System 7.1.2 and later

C 61.45% Makefile 0.91% HTML 32.10% CSS 0.24% Roff 0.47% C++ 1.16% R 3.66%

maclua5.3's Introduction

What is this?

This is a "proper" port of Lua 5.3 to the greatest, most modern operating system in the world: Classic MacOS!

Requirements

  • 68020 or better
  • At least 1MB of memory
  • System 7.1.2 or later
  • CFM-68K Runtime Enabler (not required on PowerPC)

Lua Engine

Drag the "Lua 5.3 Engine" onto the System Folder and it will be available to applications on your system.

Lua Interpreter

This application will execute any Lua script that you drag onto it. If the creator code of the script is set to 'Lua!', you can double-click the script as well.

It uses SIOW to present text input and output.

A screenshot of the Lua REPL, as seen within the Lua Interpreter application.

MPW Tools

If you have MPW or ToolServer, drop the "Lua" and "LuaC" files into its Tools directory. These allow you to use the respective commands in the respective environments.

All the usual command line options and features are fully supported. You can even interact with the Lua REPL from within MPW:

A screenshot of an interactive Lua session within an MPW Worksheet.

Both tools also support Commando:

A screenshot of a complex Lua command line built with Commando.

Building

Only building using MPW is supported.

Included is an MPW MakeFile for the engine, the MPW tools, and the application. Build with something like:

Directory 'My Hard Disk:MacLua5.3'
BuildProgram All

This will build all four targets. (You will get some warnings about it being a bad idea to link applications as cfmflat; ignore them, these particular applications have good reasons to be cfmflat.)

Building Other Versions

In addition to editing the MakeFile, you should look through the .r files in the Sources directory and edit all references to the current Lua version and its copyright. You will also have to apply my changes to the original Lua sources; this is left as an exercise for the reader.

Modules

This port has full support for modules, including native ones. Modules should be placed into the "Lua 5.3 Modules" folder next to the application, or in the natural place next to the script(s) that require them.

Default search paths for Lua modules:

  • !:Lua 5.3 Modules:?.lua
  • !:Lua 5.3 Modules:?:init.lua
  • :?.lua
  • :?:init.lua

And for native modules:

  • !:Lua 5.3 Modules:?
  • !:Lua 5.3 Modules:LoadAll
  • :?

(! gets replaced by the path to the folder containing application, usually either MPW or Lua Interpreter.)

Building Native Modules

An example module is provided. To aid in illustrating the process of creating a new native module, the example module is not included in the MakeFile. Gestalt.make must be created with CreateMake:

CreateMake Gestalt :Sources:gestalt.c "Lua 5.3 Engine" -objdir :Objects: -shrlib -fat -model cfm68k -i :Sources:lua-5.3.5:src: -export luaopen_gestalt -c Lua! -opt speed

Then BuildProgram Gestalt will build the module. It has a single function, which is a wrapper around the Gestalt system call.

gestalt = require "gestalt"
if gestalt("afps") & 0x20000000 ~= 0 then
  print("AppleShare over TCP/IP is supported on your system.")
else
  print("AppleShare over TCP/IP is NOT supported on your system.")
end

Wishlist

Some more things that would be nice to have:

  • A "Lua Application" wrapper that executes Lua code as a native Mac application.
  • More Macintosh Toolbox bindings, particularly for the Resource Manager and File Manager.

Copying

This port is covered by the same license as Lua itself, the MIT license.

maclua5.3's People

Contributors

solrabizna avatar

Watchers

Jonathan Watmough avatar James Cloos avatar  avatar

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.