diff --git a/.gitignore b/.gitignore index 59e812b..9208658 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /build/* /ctruLua.* -/doc/html/* -/doc/sublimetext/* +/doc/html/* \ No newline at end of file diff --git a/Makefile b/Makefile index b4d10bb..d7bd5ff 100644 --- a/Makefile +++ b/Makefile @@ -29,17 +29,15 @@ include $(DEVKITARM)/3ds_rules #--------------------------------------------------------------------------------- TARGET := ctruLua BUILD := build -SOURCES := source libs/lua-5.3.2/src libs/tremor +SOURCES := source libs/lua-5.3.1/src DATA := data -INCLUDES := include libs/lua-5.3.2/src libs/lzlib libs/tremor +INCLUDES := include libs/lua-5.3.1/src libs/lzlib #ROMFS := romfs APP_TITLE := ctruLua APP_DESCRIPTION := Lua for the 3DS. Yes, it works. APP_AUTHOR := Reuh, Firew0lf and NegiAD ICON := icon.png -APP_VERSION := $(shell git describe --abbrev=0 --tags) -LASTCOMMIT := $(shell git rev-parse HEAD) #--------------------------------------------------------------------------------- # options for code generation @@ -50,17 +48,14 @@ CFLAGS := -g -Wall -O2 -mword-relocations -std=gnu11 \ -fomit-frame-pointer -ffast-math \ $(ARCH) -CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DCTR_VERSION=\"$(APP_VERSION)\" -DCTR_BUILD=\"$(LASTCOMMIT)\" -ifneq ($(ROMFS),) - CFLAGS += -DROMFS -endif +CFLAGS += $(INCLUDE) -DARM11 -D_3DS CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -LIBS := -lsfil -ljpeg -lsftd -lfreetype -lpng -lz -lsf2d -lctru -logg -lm +LIBS := -lsfil -ljpeg -lsftd -lfreetype -lpng -lz -lsf2d -lctru -lm #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing @@ -70,8 +65,7 @@ LIBDIRS := $(CTRULIB) $(PORTLIBS) \ $(CURDIR)/libs/3ds_portlibs/build \ $(CURDIR)/libs/sf2dlib/libsf2d \ $(CURDIR)/libs/sftdlib/libsftd \ - $(CURDIR)/libs/sfillib/libsfil \ - $(CURDIR)/libs/stb + $(CURDIR)/libs/sfillib/libsfil #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -135,6 +129,7 @@ endif ifneq ($(ROMFS),) export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) + CFLAGS += -DROMFS endif .PHONY: $(BUILD) clean all @@ -147,7 +142,7 @@ $(BUILD): @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile build-portlibs: - @make -C libs/3ds_portlibs zlib freetype libjpeg-turbo libpng libogg + @make -C libs/3ds_portlibs zlib freetype libjpeg-turbo libpng build-sf2dlib: @make -C libs/sf2dlib/libsf2d build @@ -171,17 +166,8 @@ build-all: @make build build-doc: - @echo Building HTML documentation... - @make build-doc-html - @echo Building SublimeText documentation... - @make build-doc-st - -build-doc-html: @cd doc/ && ldoc . && cd .. -build-doc-st: - @cd doc/ && ldoc . --template ./ --ext sublime-completions --dir ./sublimetext/ && cd .. - #--------------------------------------------------------------------------------- clean: @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf @@ -211,17 +197,8 @@ clean-all: @make clean clean-doc: - @echo Cleaning HTML documentation... - @make clean-doc-html - @echo Cleaning SublimeText documentation... - @make clean-doc-st - -clean-doc-html: @rm -rf doc/html -clean-doc-st: - @rm -rf doc/sublimetext - #--------------------------------------------------------------------------------- else diff --git a/README.md b/README.md index 75dbf84..6232241 100644 --- a/README.md +++ b/README.md @@ -1,86 +1,25 @@ # ctrµLua - + +Everything is in the Wiki. Warning: the 'u' in the repo's name is a 'µ', not a 'u'. -### Users part +#### Builds  -#### How to install - -* Download ctruLua.zip from the [releases](https://github.com/ctruLua/ctruLua/releases) (for something stable) or the [CI server](https://reuh.eu/ctrulua/ci/ctrulua) (for more features) -* Unzip it on your SD card, in a folder inside your homebrews folder; if you use HBL, extract it in `/3ds/ctrulua/` -* Put some scripts wherever you want, just remember where -* Launch CtrµLua from your homebrew launcher -* Use the shell to run your scripts - -### Homebrewers part - -#### Builds  - -* Most recent working build: [ctruLua.3dsx](https://reuh.eu/ctrulua/ci/ctrulua/builds/latest/artifacts/ctruLua.3dsx) -* See [https://reuh.eu/ctrulua/ci/ctrulua](https://reuh.eu/ctrulua/ci/ctrulua) for all the builds. - -#### Hello world - -```Lua -local ctr = require("ctr") -local gfx = require("ctr.gfx") -local hid = require("ctr.hid") - -while ctr.run() do - hid.read() - local keys = hid.keys() - if keys.held.start then break end - - gfx.start(gfx.TOP) - gfx.text(2, 2, "Hello, world !") - gfx.stop() - - gfx.render() -end -``` -This script will print "Hello, world !" on the top screen, and will exit if the user presses Start. -This is the "graphical" version; there's also a text-only version, based on the console: -```Lua -local ctr = require("ctr") -local gfx = require("ctr.gfx") -local hid = require("ctr.hid") - -gfx.console() -print("Hello, world !") - -while ctr.run() do - hid.read() - local keys = hid.keys() - if keys.held.start then break end - - gfx.render() -end - -gfx.disableConsole() -``` - -#### Lua API Documentation - -* An online version of the documentation can be found [here](https://reuh.eu/ctrulua/latest/html/) -* To build the documentation, run `make build-doc-html` (requires [LDoc](https://github.com/stevedonovan/LDoc)). - -### Developers part +* Most recent working build: [here](http://thomas99.no-ip.org:3000/ctrulua/builds/latest/artifacts/ctruLua.3dsx) (warning: only tested with Citra, sometimes on real hardware). +* See http://thomas99.no-ip.org:3000/ctrulua for all the builds. #### Build instructions * Setup your environment as shown here : http://3dbrew.org/wiki/Setting_up_Development_Environment * Clone this repository and run the command `make build-all` to build all the dependencies. -* If you only made changes to ctrµLua, run `make` to rebuild ctrµLua without rebuilding all the dependencies. +* If you only made changes to ctrµLua, run `make` to rebuild ctµLua without rebuilding all the dependencies. May not work under Windows. -### Credits +#### Lua API Documentation -* __Smealum__ and everyone who worked on the ctrulib: [https://github.com/smealum/ctrulib](https://github.com/smealum/ctrulib) -* __Xerpi__ for the [sf2dlib](https://github.com/xerpi/sf2dlib), [sftdlib](https://github.com/xerpi/sftdlib) and [sfillib](https://github.com/xerpi/sfillib) -* __All the [Citra](https://citra-emu.org/) developers__ -* __Everyone who worked on [DevKitARM](http://devkitpro.org/)__ -* __Nothings__ for the [stb](https://github.com/nothings/stb) libs -* Everyone who worked on the other libs we use - +* An online version of the documentation can be found here : http://thomas99.no-ip.org/ctrulua +* To build the documentation, run `make build-doc` (requires [LDoc](https://github.com/stevedonovan/LDoc)). + +#### Based on ctrulib by smealum: [https://github.com/smealum/ctrulib](https://github.com/smealum/ctrulib) diff --git a/doc/config.ld b/doc/config.ld index cfecb59..13c1958 100644 --- a/doc/config.ld +++ b/doc/config.ld @@ -11,7 +11,7 @@ format = "markdown" plain = true -- Input files -topics = {"../README.md", "filepicker.md"} +topics = "../README.md" file = "../source/" examples = "../sdcard/3ds/ctruLua/examples/" manual_url = "file://../libs/lua-5.3.1/doc/manual.html" diff --git a/doc/filepicker.md b/doc/filepicker.md deleted file mode 100644 index 7f89590..0000000 --- a/doc/filepicker.md +++ /dev/null @@ -1,93 +0,0 @@ -# filepicker -## filePicker([workingDirectory[, bindings[, callbacks[, ...]]]]) -### Argument: workingDirectory -The directory that shows up first in the file browser. -If this is nil, ctr.fs.getDirectory() is used. -The recommended form is sdmc:/path/ or romfs:/path/, but it can be a simple /path/ instead. -#### Possible values -- string -- nil - -### Argument: bindings -A table, list of filetypes and key bindings related to these filetypes. -#### Format -``` -{ - __default, __directory, [Lua regexp] = { - [keys from ctr.hid.keys()] = { - function - string - }... - __name = string - }... -} -``` - -The Lua regexp is matched against the filename to determine if it is of this type. -__directory is the "file type" for directories -__default is the "file type" for files that cannot be matched with any other. - Also, every other type inherits the values it doesn't define from __default. -A file type contains the human-readable name (__name) of the type, displayed on the bottom screen, - as well as an optional binding for each key. -The optional binding is formed of an anonymous function, followed by the key's label to be displayed on the bottom screen, - if the label is nil, the key isn't displayed but still bound. - -The function is defined as-is: -##### function(externalConfig, selected, bindingPattern, bindingKey) -externalConfig.workingDirectory is the active directory for filePicker, doesn't necessarily match ctrµLua's. -externalConfig.bindings, externalConfig.callbacks and externalConfig.additionalArguments all are the arguments passed to filePicker, - starting from position 2. -externalConfig.fileList is the list of files currently displayed by filePicker, in the same format as is returned by ctr.fs.listDirectory(). -selected.inList is the absolute position of the cursor in externalConfig.fileList -selected.offset is the number of items skipped for display from fileList -bindingPattern is the [Lua regexp] defined earlier, and bindingKey the [key] that triggered this event. -This function may return the same thing as filePicker itself (Defined later here), or nothing. If it returns nothing, -filePicker will keep running, if it returns the same returns as filePicker, filePicker will exit, returning these values. - -#### Notes -Sane defaults are set if you did not set them otherwise: -__default.x quits filePicker, returning the current directory, "__directory", nil and "x". See the returns to understand what this means. -__directory.a changes directories to that directory. - -### Argument: callbacks -A table defining the callbacks ran at the end of each of the equivalent phases. -#### Format -``` -{ - drawTop, drawBottom, eventHandler = function -} -``` -All of these take the following parameters: (externalConfig, selected) -They have the meaning defined earlier. - -#### Notes -Although drawTop and drawBottom are ran at the end of their respective functions, -eventHandler is not, as it cannot be without being run repeatedly, so it's run at the beginning of -the ACTUAL eventHandler instead of its end. - -### Argument: ... -Additional parameters. All of these are aggregated orderly in externalConfig.additionalArguments and passed around as explained earlier. -They have no specific meaning unless defined so by event handling functions. - -### Return 1: selectedPath -The path selected by the either, may or may not have the sdmc:/romfs: prefix, depending on your input. -A string. - -### Return 2: bindingPattern -The pattern the file matched to. You can use this to know exactly which kind of file you're dealing with -A string. - -### Return 3: mode -Included handlers may have it be "open", in case you're opening an existing file, "new" in case the user wants to create a new file, -Or nil. A "nil" is assumed to mean that the user didn't pick anything. -A string or nil. - -### Return 4: key -The key that triggered the event that made filePicker exit. -A string. - -## Included event handlers you have available are: -- filepicker.changeDirectory - The name is on the tin, change workingDirectory to the active element and refresh the file list for that path. -- filepicker.openFile - Quits and returns as described by this document based on the active element. -- filepicker.newFile - Prompts the user to input a file name manually, relative to the current working directory, and with FAT-incompatible characters excluded. Quits and returns that. -- filepicker.nothing - Do nothing and keep on running. Literally. This is used as a plug to enable an action for all (or a certain type) but files of a certain type (or more precise than the initial type). \ No newline at end of file diff --git a/doc/ldoc.ltp b/doc/ldoc.ltp deleted file mode 100644 index ca2ab5d..0000000 --- a/doc/ldoc.ltp +++ /dev/null @@ -1,118 +0,0 @@ -# -- LDoc template by Reuh. -# -- Generates sublime-completions files which can be used in Sublime Text 3 for autocompletion. -# -- Based on the HTML template, so generated files will contain lots of comments with additionnal data not handled by ST. -# -- I tried to make the generated files human-readable, so they may be used instead of the HTML documentation. -# -- Typical usage: ldoc . --template ./ --ext sublime-completions --dir ./sublimetext/ -# -# local scope = "source.lua" -# local function e(str) return (str or ""):gsub("\"", "\\\"") end -- escape json string ("str") -# local function indent(indentation, str) -- indent str (except first line) with indentation -# return (str or ""):gsub("(.-)\n", indentation.."%1\n"):gsub("\n([^\n]*)$", "\n"..indentation.."%1"):gsub("^"..indentation, "") -# end -# local function displayName(item) return item.type == "function" and item.name..item.args or item.name end -- nice name -# local function autocompleteName(item) -- ST-autocomplete name -# if item.type == "function" then -# local i = 1 -# local args = "(" -# for arg in (item.args:match("^%((.*)%)$")..","):gmatch("%s*([^,]+)%,") do -# args = args.."${"..i..":"..arg.."}, " -# i = i +1 -# end -# return item.name..args:gsub("%, $", "")..")" -# else return item.name end -# end -/* -Title: $(ldoc.title) -Project: $(ldoc.project) -Description: $(ldoc.description) -# if ldoc.single then -(Single module-project) -# end -# if not module then - -Project contents: -# for kind, mods in ldoc.kinds() do - $(kind) -# for m in mods() do - $(m.name): $(m.summary) -# end -# end -*/ -# else -- if not module -*/ - -/* -Module: $(module.name) -Summary: $(module.summary) -Description: $(module.description) - -Module contents: -# for kind, items in module.kinds() do - $(kind) -# for item in items() do - $(item.type) $(displayName(item)) -# end -# end -*/ - -/* Completions */ -{ - "scope": "$(e(scope))", - - "completions": [ -# for kind, items in module.kinds() do - /* $(kind) */ -# for item in items() do - /* - $(item.type) $(displayName(item)) - Summary: $(item.summary) - Description: $(indent("\t\t\t", item.description)) -# if item.type == "function" then - Parameters: -# for p in item.params:iter() do -# local default = item:default_of_param(p) -# if default == true then default = "(optional)" -# elseif default then default = "(defaults to "..default..")" end - ($(item:type_of_param(p))) $(item:display_name_of(p)):$(item.params.map[p]) $(default) -# end -# local retgroups = item.retgroups or {} - Returns: -# for i, group in ldoc.ipairs(retgroups) do -# for ret in group:iter() do - ($(ret.type)) $(indent("\t\t\t", ret.text)) -# end -# if i < #retgroups then - ---or--- -# end -# end -# end -# if item.usage then - Usage: -# for i, usage in ldoc.ipairs(item.usage) do - $(sep)$(indent("\t\t\t", usage:gsub("^\n", ""))) -# if i < #item.usage then - -------- -# end -# end -# end -# if item.see then - See also: -# for see in item.see:iter() do - $(see.mod.name): $(see.name) -# end -# end - */ -# for pos in (module.name.."."):gmatch("()[^.]+%.") do -# local prefix = e(module.name:sub(pos) .. (item.name:match("^[%.%:]") and "" or ".")) - { - "trigger": "$(prefix)$(e(item.name))\t$(e(item.summary))", - "contents": "$(prefix)$(e(autocompleteName(item)))" - }, -# end -# end -# end - ] -} -# end -- if not module - -/* Generated by LDoc; sublime-completions template by Reuh. Last updated $(ldoc.updatetime).*/ diff --git a/icon.png b/icon.png index 5c7a62b..f035c56 100644 Binary files a/icon.png and b/icon.png differ diff --git a/libs/3ds_portlibs/.gitignore b/libs/3ds_portlibs/.gitignore index 8e0d03f..115f9d0 100644 --- a/libs/3ds_portlibs/.gitignore +++ b/libs/3ds_portlibs/.gitignore @@ -4,6 +4,4 @@ libjpeg-* libpng-* sqlite-* zlib-* -libogg-* -libvorbis-* build/ \ No newline at end of file diff --git a/libs/3ds_portlibs/Makefile b/libs/3ds_portlibs/Makefile index c47b8c1..355b8ad 100644 --- a/libs/3ds_portlibs/Makefile +++ b/libs/3ds_portlibs/Makefile @@ -28,16 +28,6 @@ ZLIB_VERSION := $(ZLIB)-1.2.8 ZLIB_SRC := $(ZLIB_VERSION).tar.gz ZLIB_DOWNLOAD := "http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz" -LIBOGG := libogg -LIBOGG_VERSION := $(LIBOGG)-1.3.2 -LIBOGG_SRC := $(LIBOGG_VERSION).tar.gz -LIBOGG_DOWNLOAD := "http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz" - -LIBVORBIS := libvorbis -LIBVORBIS_VERSION := $(LIBVORBIS)-1.3.5 -LIBVORBIS_SRC := $(LIBVORBIS_VERSION).tar.gz -LIBVORBIS_DOWNLOAD := "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz" - export PORTLIBS := $(CURDIR)/build export PATH := $(DEVKITARM)/bin:$(PATH) export PKG_CONFIG_PATH := $(PORTLIBS)/lib/pkgconfig @@ -76,8 +66,8 @@ $(FREETYPE): $(FREETYPE_SRC) ./configure --prefix=$(PORTLIBS) --host=arm-none-eabi --disable-shared --enable-static --without-harfbuzz @$(MAKE) -C $(FREETYPE_VERSION) @make create_build_dir - @cp -srf $(CURDIR)/$(FREETYPE_VERSION)/include/. $(CURDIR)/build/include - @cp -sf $(CURDIR)/$(FREETYPE_VERSION)/objs/.libs/libfreetype.a $(CURDIR)/build/lib/libfreetype.a + @cp -srf $(CURDIR)/freetype-2.6/include/. $(CURDIR)/build/include + @cp -sf $(CURDIR)/freetype-2.6/objs/.libs/libfreetype.a $(CURDIR)/build/lib/libfreetype.a $(LIBEXIF): $(LIBEXIF_SRC) @[ -d $(LIBEXIF_VERSION) ] || tar -xf $< @@ -91,8 +81,8 @@ $(LIBJPEGTURBO): $(LIBJPEGTURBO_SRC) ./configure --prefix=$(PORTLIBS) --host=arm-none-eabi --disable-shared --enable-static @$(MAKE) CFLAGS+="\"-Drandom()=rand()\"" -C $(LIBJPEGTURBO_VERSION) @make create_build_dir - @cp -sf $(CURDIR)/$(LIBJPEGTURBO_VERSION)/*.h $(CURDIR)/build/include - @cp -sf $(CURDIR)/$(LIBJPEGTURBO_VERSION)/.libs/libjpeg.a $(CURDIR)/build/lib/libjpeg.a + @cp -sf $(CURDIR)/libjpeg-turbo-*/*.h $(CURDIR)/build/include + @cp -sf $(CURDIR)/libjpeg-turbo-*/.libs/libjpeg.a $(CURDIR)/build/lib/libjpeg.a $(LIBPNG): $(LIBPNG_SRC) @[ -d $(LIBPNG_VERSION) ] || tar -xf $< @@ -100,8 +90,8 @@ $(LIBPNG): $(LIBPNG_SRC) ./configure --prefix=$(PORTLIBS) --host=arm-none-eabi --disable-shared --enable-static @$(MAKE) -C $(LIBPNG_VERSION) @make create_build_dir - @cp -sf $(CURDIR)/$(LIBPNG_VERSION)/*.h $(CURDIR)/build/include - @cp -sf $(CURDIR)/$(LIBPNG_VERSION)/.libs/*.a $(CURDIR)/build/lib/libpng.a + @cp -sf $(CURDIR)/libpng-*/*.h $(CURDIR)/build/include + @cp -sf $(CURDIR)/libpng-*/.libs/*.a $(CURDIR)/build/lib/libpng.a # sqlite won't work with -ffast-math $(SQLITE): $(SQLITE_SRC) @@ -117,26 +107,8 @@ $(ZLIB): $(ZLIB_SRC) CHOST=arm-none-eabi ./configure --static --prefix=$(PORTLIBS) @$(MAKE) -C $(ZLIB_VERSION) @make create_build_dir - @cp -sf $(CURDIR)/$(ZLIB_VERSION)/*.h $(CURDIR)/build/include - @cp -sf $(CURDIR)/$(ZLIB_VERSION)/libz.a $(CURDIR)/build/lib/libz.a - -$(LIBOGG): $(LIBOGG_SRC) - @[ -d $(LIBOGG_VERSION) ] || tar -xf $< - @cd $(LIBOGG_VERSION) && \ - ./configure --prefix=$(PORTLIBS) --host=arm-none-eabi --disable-shared --enable-static - @$(MAKE) -C $(LIBOGG_VERSION) - @make create_build_dir - @cp -srf $(CURDIR)/$(LIBOGG_VERSION)/include/. $(CURDIR)/build/include - @cp -sf $(CURDIR)/$(LIBOGG_VERSION)/src/.libs/*.a $(CURDIR)/build/lib - -$(LIBVORBIS): $(LIBVORBIS_SRC) - @[ -d $(LIBVORBIS_VERSION) ] || tar -xf $< - @cd $(LIBVORBIS_VERSION) && \ - ./configure --prefix=$(PORTLIBS) --host=arm-none-eabi --disable-shared --enable-static - @$(MAKE) -C $(LIBVORBIS_VERSION) - @make create_build_dir - @cp -srf $(CURDIR)/$(LIBVORBIS_VERSION)/include/. $(CURDIR)/build/include - @cp -sf $(CURDIR)/$(LIBVORBIS_VERSION)/lib/.libs/*.a $(CURDIR)/build/lib + @cp -sf $(CURDIR)/zlib-*/*.h $(CURDIR)/build/include + @cp -sf $(CURDIR)/zlib-*/libz.a $(CURDIR)/build/lib/libz.a # Downloads $(ZLIB_SRC): @@ -157,12 +129,6 @@ $(LIBPNG_SRC): $(SQLITE_SRC): wget -O $@ $(SQLITE_DOWNLOAD) -$(LIBOGG_SRC): - wget -O $@ $(LIBOGG_DOWNLOAD) - -$(LIBVORBIS_SRC): - wget -O $@ $(LIBVORBIS_DOWNLOAD) - install-zlib: @$(MAKE) -C $(ZLIB_VERSION) install @@ -172,8 +138,6 @@ install: @[ ! -d $(LIBJPEGTURBO_VERSION) ] || $(MAKE) -C $(LIBJPEGTURBO_VERSION) install @[ ! -d $(LIBPNG_VERSION) ] || $(MAKE) -C $(LIBPNG_VERSION) install @[ ! -d $(SQLITE_VERSION) ] || $(MAKE) -C $(SQLITE_VERSION) install-libLTLIBRARIES install-data - @[ ! -d $(LIBOGG_VERSION) ] || $(MAKE) -C $(LIBOGG_VERSION) install - @[ ! -d $(LIBVORBIS_VERSION) ] || $(MAKE) -C $(LIBVORBIS_VERSION) install clean: @$(RM) -r $(FREETYPE_VERSION) @@ -182,7 +146,5 @@ clean: @$(RM) -r $(LIBPNG_VERSION) @$(RM) -r $(SQLITE_VERSION) @$(RM) -r $(ZLIB_VERSION) - @$(RM) -r $(LIBOGG_VERSION) - @$(RM) -r $(LIBVORBIS_VERSION) @rm -rf $(CURDIR)/build @rm -f $(CURDIR)/*.tar.* diff --git a/libs/lua-5.3.2/Makefile b/libs/lua-5.3.1/Makefile similarity index 99% rename from libs/lua-5.3.2/Makefile rename to libs/lua-5.3.1/Makefile index e87e958..5ee5601 100644 --- a/libs/lua-5.3.2/Makefile +++ b/libs/lua-5.3.1/Makefile @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.3 -R= $V.2 +R= $V.1 # Targets start here. all: $(PLAT) diff --git a/libs/lua-5.3.2/README b/libs/lua-5.3.1/README similarity index 70% rename from libs/lua-5.3.2/README rename to libs/lua-5.3.1/README index eb6247a..d6ae660 100644 --- a/libs/lua-5.3.2/README +++ b/libs/lua-5.3.1/README @@ -1,5 +1,5 @@ -This is Lua 5.3.2, released on 25 Nov 2015. +This is Lua 5.3.1, released on 10 Jun 2015. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/libs/lua-5.3.2/doc/contents.html b/libs/lua-5.3.1/doc/contents.html similarity index 100% rename from libs/lua-5.3.2/doc/contents.html rename to libs/lua-5.3.1/doc/contents.html diff --git a/libs/lua-5.3.2/doc/index.css b/libs/lua-5.3.1/doc/index.css similarity index 100% rename from libs/lua-5.3.2/doc/index.css rename to libs/lua-5.3.1/doc/index.css diff --git a/libs/lua-5.3.2/doc/logo.gif b/libs/lua-5.3.1/doc/logo.gif similarity index 100% rename from libs/lua-5.3.2/doc/logo.gif rename to libs/lua-5.3.1/doc/logo.gif diff --git a/libs/lua-5.3.2/doc/lua.1 b/libs/lua-5.3.1/doc/lua.1 similarity index 100% rename from libs/lua-5.3.2/doc/lua.1 rename to libs/lua-5.3.1/doc/lua.1 diff --git a/libs/lua-5.3.2/doc/lua.css b/libs/lua-5.3.1/doc/lua.css similarity index 85% rename from libs/lua-5.3.2/doc/lua.css rename to libs/lua-5.3.1/doc/lua.css index eb20fec..b614f3c 100644 --- a/libs/lua-5.3.2/doc/lua.css +++ b/libs/lua-5.3.1/doc/lua.css @@ -131,29 +131,3 @@ table.columns td { p.logos a:link:hover, p.logos a:visited:hover { background-color: inherit ; } - -table.book { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - -table.book td { - padding: 0 ; - vertical-align: top ; -} - -table.book td.cover { - padding-right: 1em ; -} - -table.book img { - border: solid #000080 1px ; -} - -table.book span { - font-size: small ; - text-align: left ; - display: block ; - margin-top: 0.25em ; -} diff --git a/libs/lua-5.3.2/doc/luac.1 b/libs/lua-5.3.1/doc/luac.1 similarity index 100% rename from libs/lua-5.3.2/doc/luac.1 rename to libs/lua-5.3.1/doc/luac.1 diff --git a/libs/lua-5.3.2/doc/manual.css b/libs/lua-5.3.1/doc/manual.css similarity index 100% rename from libs/lua-5.3.2/doc/manual.css rename to libs/lua-5.3.1/doc/manual.css diff --git a/libs/lua-5.3.2/doc/manual.html b/libs/lua-5.3.1/doc/manual.html similarity index 98% rename from libs/lua-5.3.2/doc/manual.html rename to libs/lua-5.3.1/doc/manual.html index 60c4c98..f2eb313 100644 --- a/libs/lua-5.3.2/doc/manual.html +++ b/libs/lua-5.3.1/doc/manual.html @@ -35,7 +35,7 @@ Freely available under the terms of the
-
+
@@ -398,7 +398,7 @@ You can replace the metatable of tables
using the setmetatable function.
You cannot change the metatable of other types from Lua code
(except by using the debug library (§6.10));
-you should use the C API for that.
+you must use the C API for that.
@@ -589,7 +589,7 @@ The result of the call is always converted to a boolean.
the <= (less equal) operation.
Unlike other operations,
-the less-equal operation can use two different events.
+The less-equal operation can use two different events.
First, Lua looks for the "__le" metamethod in both operands,
like in the "lt" operation.
If it cannot find such a metamethod,
@@ -1051,8 +1051,7 @@ except as delimiters between names and keywords.
(also called identifiers)
in Lua can be any string of letters,
digits, and underscores,
-not beginning with a digit and
-not being a reserved word.
+not beginning with a digit.
Identifiers are used to name variables, table fields, and labels.
@@ -2707,9 +2706,7 @@ The first upvalue associated with a function is at index
lua_upvalueindex(1), and so on.
Any access to lua_upvalueindex(n),
where n is greater than the number of upvalues of the
-current function
-(but not greater than 256,
-which is one plus the maximum number of upvalues in a closure),
+current function (but not greater than 256),
produces an acceptable but invalid index.
@@ -2974,7 +2971,6 @@ by looking only at its arguments
The third field, x,
tells whether the function may raise errors:
'-' means the function never raises any error;
-'m' means the function may raise memory errors;
'e' means the function may raise errors;
'v' means the function may raise an error on purpose.
@@ -3147,8 +3143,7 @@ The function results are pushed onto the stack when the function returns.
The number of results is adjusted to nresults,
unless nresults is LUA_MULTRET.
In this case, all results from the function are pushed.
-Lua takes care that the returned values fit into the stack space,
-but it does not ensure any extra space in the stack.
+Lua takes care that the returned values fit into the stack space.
The function results are pushed onto the stack in direct order
(the first result is pushed first),
so that after the call the last result is on the top of the stack.
@@ -3258,15 +3253,14 @@ of numeric arguments and returns their average and their sum:
int lua_checkstack (lua_State *L, int n);
-Ensures that the stack has space for at least n extra slots
-(that is, that you can safely push up to n values into it).
+Ensures that the stack has space for at least n extra slots.
It returns false if it cannot fulfill the request,
either because it would cause the stack
to be larger than a fixed maximum size
(typically at least several thousand elements) or
because it cannot allocate memory for the extra space.
This function never shrinks the stack;
-if the stack already has space for the extra slots,
+if the stack is already larger than the new size,
it is left unchanged.
@@ -3351,7 +3345,7 @@ Values at other positions are not affected.
lua_createtable-[-0, +1, m] +[-0, +1, e]
void lua_createtable (lua_State *L, int narr, int nrec);
@@ -3361,7 +3355,7 @@ will have as a sequence;
parameter
-[-0, +0, –]
+[-0, +0, e]
-[-0, +1, m]
+[-0, +1, e]
@@ -3996,7 +3990,7 @@ It is equivalent to
-[-0, +1, m]
+[-0, +1, e]
@@ -4017,7 +4011,7 @@ like any Lua object.
-[-0, +1, m]
+[-0, +1, e]
@@ -4227,7 +4221,7 @@ Pushes a boolean value with value
-[-n, +1, m]
+[-n, +1, e]
@@ -4284,7 +4278,7 @@ and return its results (see
-[-0, +1, m]
+[-0, +1, e]
@@ -4364,7 +4358,7 @@ light userdata with the same C address.
-[-0, +1, m]
+[-0, +1, e]
@@ -4376,7 +4370,7 @@ but should be used only when
-[-0, +1, m]
+[-0, +1, e]
@@ -4419,7 +4413,7 @@ Pushes a float with value
-[-0, +1, m]
+[-0, +1, e]
@@ -4466,7 +4460,7 @@ onto the stack.
-[-0, +1, m]
+[-0, +1, e]
-[-2, +0, m]
+[-2, +0, e]
@@ -4573,7 +4567,7 @@ Similar to
-[-1, +0, m]
+[-1, +0, e]
@@ -4592,7 +4586,7 @@ that is, it does not invoke metamethods.
-[-1, +0, m]
+[-1, +0, e]
@@ -4995,13 +4989,13 @@ indicates whether the operation succeeded.
-[-0, +0, m]
+[-0, +0, e]
Converts the Lua value at the given index to a C string.
If
-
-[-0, +0, m]
+[-0, +0, e]
@@ -5890,7 +5884,7 @@ in alphabetical order.
-[-?, +?, m]
+[-?, +?, e]
@@ -5902,7 +5896,7 @@ Adds the byte
-[-?, +?, m]
+[-?, +?, e]
@@ -5916,7 +5910,7 @@ The string can contain embedded zeros.
-[-?, +?, –]
+[-?, +?, e]
@@ -5929,7 +5923,7 @@ buffer area (see
-[-?, +?, m]
+[-?, +?, e]
@@ -5942,7 +5936,7 @@ to the buffer
-[-1, +?, m]
+[-1, +?, e]
@@ -6080,7 +6074,7 @@ the buffer must be declared as a variable
-[-?, +?, m]
+[-?, +?, e]
@@ -6331,7 +6325,7 @@ as
-[-0, +3, m]
+[-0, +3, e]
@@ -6344,7 +6338,7 @@ process-related functions in the standard library
-[-0, +(1|3), m]
+[-0, +(1|3), e]
@@ -6357,7 +6351,7 @@ file-related functions in the standard library
-[-0, +(0|1), m]
+[-0, +(0|1), e]
@@ -6372,7 +6366,7 @@ pushes nothing and returns
-[-0, +1, m]
+[-0, +1, –]
@@ -6402,7 +6396,7 @@ and false if it creates a new table.
-[-0, +1, m]
+[-0, +1, e]
-[-0, +1, m]
+[-0, +1, e]
@@ -6559,7 +6553,7 @@ not a pointer to it.
-[-0, +1, m]
+[-0, +1, e]
@@ -6580,7 +6574,7 @@ not a pointer to it.
-[-0, +1, m]
+[-0, +1, e]
@@ -6670,9 +6664,6 @@ Otherwise, raises an error.
If
-[-?, +?, m]
+[-?, +?, e]
@@ -6723,7 +6714,7 @@ with the predefined size
-[-?, +?, m]
+[-?, +?, e]
@@ -6739,7 +6730,7 @@ it to the buffer.
-[-?, +1, m]
+[-?, +1, e]
@@ -6751,7 +6742,7 @@ the top of the stack.
-[-?, +1, m]
+[-?, +1, e]
@@ -6762,7 +6753,7 @@ Equivalent to the sequence
-[-1, +0, m]
+[-1, +0, e]
@@ -6833,7 +6824,7 @@ Leaves a copy of the module on the stack.
-[-nup, +0, m]
+[-nup, +0, e]
@@ -6897,7 +6888,7 @@ this function receives the file handle as its sole argument and
must return either true (in case of success)
or nil plus an error message (in case of error).
Once Lua calls this field,
-it changes the field value to
-[-0, +0, m]
+[-0, +0, e]
@@ -6941,7 +6932,7 @@ and uses the result of the call as its result.
-[-0, +1, m]
+[-0, +1, e]
-[-0, +1, m]
+[-0, +1, e]
@@ -7485,8 +7476,7 @@ and
Sets the metatable for the given table.
-(To change the metatable of other types from Lua code,
-you must use the debug library (§6.10).)
+(You cannot change the metatable of other types from Lua, only from C.)
If
A global variable (not a function) that
-holds a string containing the running Lua version.
+holds a string containing the current interpreter version.
The current value of this variable is "
@@ -8407,11 +8392,6 @@ The default value for
-(Note that it is very easy to exhaust the memory of your machine
-with a single call to this function.)
-
-
@@ -8983,23 +8963,14 @@ If
-Note that the
The sort algorithm is not stable;
-that is, elements not comparable by the given order
-(e.g., equal elements)
+that is, elements considered equal by the given order
may have their relative positions changed by the sort.
@@ -9251,13 +9222,14 @@ in the range [0,1).
When called with two integers
This function is an interface to the underling
pseudo-random generator function provided by C.
+No guarantees can be given for its statistical properties.
@@ -9425,7 +9397,7 @@ instead of returning an error code.
-
@@ -9799,7 +9771,7 @@ then the date is formatted in Coordinated Universal Time.
After this optional character,
if
When called without arguments,
@@ -10825,10 +10797,10 @@ and LiteralString, see §3.1.)
nrec is a hint for how many other elements
the table will have.
Lua may use these hints to preallocate memory for the new table.
-This preallocation is useful for performance when you know in advance
+This pre-allocation is useful for performance when you know in advance
how many elements the table will have.
Otherwise you can use the function lua_newtable.
@@ -3370,7 +3364,7 @@ Otherwise you can use the function lua_newtablelua_dumpint lua_dump (lua_State *L,
lua_Writer writer,
void *data,
@@ -3984,7 +3978,7 @@ passes to the allocator in every call.
lua_newtablevoid lua_newtable (lua_State *L);
lua_createtable(L, 0, 0).
lua_newthreadlua_State *lua_newthread (lua_State *L);
lua_newuserdatavoid *lua_newuserdata (lua_State *L, size_t size);
b onto the stack.
lua_pushcclosurevoid lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
lua_CFunction<
lua_pushfstringconst char *lua_pushfstring (lua_State *L, const char *fmt, ...);
lua_pushliteralconst char *lua_pushliteral (lua_State *L, const char *s);
s is a literal string.
lua_pushlstringconst char *lua_pushlstring (lua_State *L, const char *s, size_t len);
n onto the stack.
lua_pushstringconst char *lua_pushstring (lua_State *L, const char *s);
lua_pushvfstringconst char *lua_pushvfstring (lua_State *L,
const char *fmt,
va_list argp);
@@ -4561,7 +4555,7 @@ for other values, it is 0.
lua_rawsetvoid lua_rawset (lua_State *L, int index);
lua_settable, but does a raw
lua_rawsetivoid lua_rawseti (lua_State *L, int index, lua_Integer i);
lua_rawsetpvoid lua_rawsetp (lua_State *L, int index, const void *p);
lua_tolstringconst char *lua_tolstring (lua_State *L, int index, size_t *len);
len is not NULL,
-it sets *len with the string length.
+it also sets *len with the string length.
The Lua value must be a string or a number;
otherwise, the function returns NULL.
If the value is a number,
@@ -5012,7 +5006,7 @@ when lua_tolstring is applied to keys during a table traversal.)
lua_tolstring returns a pointer
+lua_tolstring returns a fully aligned pointer
to a string inside the Lua state.
This string always has a zero ('\0')
after its last character (as in C),
@@ -5081,7 +5075,7 @@ Typically this function is used only for hashing and debug information.
lua_tostringconst char *lua_tostring (lua_State *L, int index);
luaL_addcharvoid luaL_addchar (luaL_Buffer *B, char c);
c to the buffer B
luaL_addlstringvoid luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
luaL_addsizevoid luaL_addsize (luaL_Buffer *B, size_t n);
luaL_prepbuffer).
luaL_addstringvoid luaL_addstring (luaL_Buffer *B, const char *s);
B
luaL_addvaluevoid luaL_addvalue (luaL_Buffer *B);
luaL_buffinitsizechar *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);
return luaL_error(args).
luaL_execresultint luaL_execresult (lua_State *L, int stat);
luaL_fileresultint luaL_fileresult (lua_State *L, int stat, const char *fname);
luaL_getmetafieldint luaL_getmetafield (lua_State *L, int obj, const char *e);
LUA_TNIL.
luaL_getmetatableint luaL_getmetatable (lua_State *L, const char *tname);
luaL_gsubconst char *luaL_gsub (lua_State *L,
const char *s,
const char *p,
@@ -6537,7 +6531,7 @@ it does not run it.
luaL_newlibvoid luaL_newlib (lua_State *L, const luaL_Reg l[]);
luaL_newlibtablevoid luaL_newlibtable (lua_State *L, const luaL_Reg l[]);
luaL_newmetatableint luaL_newmetatable (lua_State *L, const char *tname);
l is not NULL,
fills the position *l with the result's length.
-If the result is NULL
-(only possible when returning d and d == NULL),
-its length is considered zero.
@@ -6711,7 +6702,7 @@ Otherwise, raises an error.
luaL_prepbufferchar *luaL_prepbuffer (luaL_Buffer *B);
LUAL_BUFFERSIZEluaL_prepbuffsizechar *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);
luaL_pushresultvoid luaL_pushresult (luaL_Buffer *B);
luaL_pushresultsizevoid luaL_pushresultsize (luaL_Buffer *B, size_t sz);
luaL_addsize
luaL_refint luaL_ref (lua_State *L, int t);
luaL_setfuncsvoid luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
NULL
+the field value is changed to NULL
to signal that the handle is closed.
@@ -6905,7 +6896,7 @@ to signal that the handle is closed.
luaL_testudatavoid *luaL_testudata (lua_State *L, int arg, const char *tname);
luaL_tracebackvoid luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
int level);
@@ -6988,7 +6979,7 @@ If ref is LUA_NOREF or luaL_wherevoid luaL_where (lua_State *L, int lvl);
select returns the total number of extra arguments it received.
metatable is nil,
removes the metatable of the given table.
If the original metatable has a "__metatable" field,
@@ -7567,11 +7557,8 @@ and "userdata".
-
-
-_VERSIONLua 5.3".
@@ -8207,11 +8194,9 @@ Options c, d,
i, o, u, X, and x
expect an integer.
Option q expects a string.
-Option s expects a string;
+Option s expects a string without embedded zeros;
if its argument is not a string,
it is converted to one following the same rules of tostring.
-If the option has any modifier (flags, width, length),
-the string argument should not contain embedded zeros.
sep is the empty string
Returns the empty string if n is not positive.
-comp is given,
then it must be a function that receives two list elements
and returns true when the first element must come
before the second in the final order
-(so that, after the sort,
-i < j implies not comp(list[j],list[i])).
+(so that not comp(list[i+1],list[i]) will be true after the sort).
If comp is not given,
then the standard Lua operator < is used instead.
-comp function must define
-a strict partial order over the elements in the list;
-that is, it must be asymmetric and transitive.
-Otherwise, no valid sort may be possible.
-
-
m and n,
math.random returns a pseudo-random integer
with uniform distribution in the range [m, n].
-(The value n-m cannot be negative and must fit in a Lua integer.)
+(The value m-n cannot be negative and must fit in a Lua integer.)
The call math.random(n) is equivalent to math.random(1,n).
+io.lines ([filename, ···])io.lines ([filename ···])format is the string "*t",
then date returns a table with the following fields:
-year, month (1–12), day (1–31),
+year (four digits), month (1–12), day (1–31),
hour (0–23), min (0–59), sec (0–61),
wday (weekday, Sunday is 1),
yday (day of the year),
@@ -9817,8 +9789,8 @@ formatted according to the same rules as the ISO C function strftime<
date returns a reasonable date and time representation that depends on
-the host system and on the current locale.
-(More specifically, os.date() is equivalent to os.date("%c").)
+the host system and on the current locale
+(that is, os.date() is equivalent to os.date("%c")).