Mercurial Hosting > luan
view src/luan/modules/Luan.luan @ 1820:f3ec7f053078 default tip
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 30 Jun 2024 20:54:36 -0600 |
parents | 0ead5c6b07b0 |
children |
line wrap: on
line source
require "java" local LuanJava = require "java:luan.Luan" local BasicLuan = require "java:luan.modules.BasicLuan" local TableLuan = require "java:luan.modules.TableLuan" local LuanParser = require "java:luan.modules.parsers.LuanParser" local Boot = require "luan:Boot.luan" local Luan = {} local error = Boot.error Luan.error = error Luan.get_metatable = BasicLuan.get_metatable Luan.hash_code = BasicLuan.hash_code Luan.ipairs = BasicLuan.ipairs local java_load = BasicLuan.load local load_file = Boot.load_file Luan.load_file = load_file Luan.new_error = BasicLuan.new_error Luan.pairs = BasicLuan.pairs Luan.parse = LuanParser.parse Luan.range = BasicLuan.range Luan.raw_equal = BasicLuan.raw_equal Luan.raw_get = BasicLuan.raw_get Luan.raw_len = BasicLuan.raw_len Luan.raw_set = BasicLuan.raw_set Luan.set_metatable = BasicLuan.set_metatable Luan.stringify = BasicLuan.stringify Luan.to_string = BasicLuan.to_string Luan.type = BasicLuan.type Luan.values = BasicLuan.values local function load(text,source_name,env,persist) return java_load( text, source_name or "load", persist==true, env ) end Luan.load = load function Luan.do_file(uri) local fn = load_file(uri) or error("file '"..uri.."' not found") return fn() end Luan.VERSION = Luan.do_file "classpath:luan/version.luan" function Luan.eval(s,source_name,env) return load( "return "..s, source_name or "eval", env )() end if LuanJava.args ~= nil then local args = TableLuan.toTable(LuanJava.args) if #args > 0 then args[0] = TableLuan.remove(args,1) end Luan.arg = args end -- local functions Luan.get_local_cloned = BasicLuan.get_local_cloned Luan.get_local_only = BasicLuan.get_local_only Luan.pairs_local_cloned = BasicLuan.pairs_local_cloned Luan.pairs_local_only = BasicLuan.pairs_local_only Luan.set_local_cloned = BasicLuan.set_local_cloned Luan.set_local_only = BasicLuan.set_local_only return Luan