[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua 5.0 using old Plua on PalmPilot
- From: Doug Rogers <rogers@...>
- Date: Fri, 30 Apr 2004 14:57:52 -0400
Lua and PalmPilot afficionados,
I have attached a simple set of table definitions to map the Lua 5.0 names
back to Lua 4.0 that is used by Plua on the PalmPilot. I then put the
following at the top of each of my Plua memos:
if string == nil then dofile "memo:lua5.lua" end
I find this to be useful - at least until the new PalmPilot Lua project is up
to speed.
Doug
--
--__-__-____------_--_-_-_-___-___-____-_--_-___--____
Doug Rogers - ICI - V:703.893.2007x220 www.innocon.com
-_-_--_------____-_-_-___-_--___-_-___-_-_---_--_-__-_
-- lua5.lua
-- Creates Lua 5.x standard library
-- tables.
function __unavailable ()
error("function not implemented")
end
function setmetatable(obj,mt)
-- Copy functions into local object;
-- not the best, but passable.
for k,v in mt do
if type(v) == "function" then
obj[k] = v
end
end
end -- setmetatable()
coroutine = {}
coroutine.create = __unavailable
coroutine.resume = __unavailable
coroutine.status = __unavailable
coroutine.wrap = __unavailable
coroutine.yield = __unavailable
math = {}
math.abs = abs
math.acos = function(x) return rad(acos(x)) end
math.asin = function(x) return rad(asin(x)) end
math.atan = function(x) return rad(atan(x)) end
math.atan2 = function(x,y) return rad(atan2(x,y)) end
math.ceil = ceil
math.cos = function(x) return cos(deg(x)) end
math.deg = deg
math.exp = exp
math.floor = floor
math.log = log
math.log10 = log10
math.max = max
math.min = min
math.mod = mod
math.pi = 3.14159265358979323846
math.pow = pow
math.rad = rad
math.sin = function(x) return sin(deg(x)) end
math.sqrt = sqrt
math.tan = function(x) return tan(deg(x)) end
math.frexp = frexp
math.ldexp = ldexp
math.random = random
math.randomseed = randomseed
os = {}
os.date = date
string = {}
string.byte = strbyte
string.char = strchar
string.dump = __unavailable
string.find = strfind
string.format = format
string.gsub = gsub
string.len = strlen
string.lower = strlower
string.rep = strrep
string.sub = strsub
string.upper = strupper
table = {}
table.concat = __unavailable
table.foreach = foreach
table.foreachi = foreachi
table.getn = getn
table.insert = tinsert
table.remove = tremove
table.sort = sort
table.setn = __unavailable
true = 1
false = nil