summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2024-05-09 22:05:24 +0300
committerjussi2024-05-09 22:05:24 +0300
commit1980aebdc32392f4975f6d1f8ecd9050f27e475f (patch)
treeeeeefe70368267385ea3e74c5106dd371e37985e
parent02e1984781259c1f02d95ccb3bde8c533ef288a8 (diff)
downloadreilua-enhanced-1980aebdc32392f4975f6d1f8ecd9050f27e475f.tar.gz
reilua-enhanced-1980aebdc32392f4975f6d1f8ecd9050f27e475f.tar.bz2
reilua-enhanced-1980aebdc32392f4975f6d1f8ecd9050f27e475f.zip
Matrix lib clone fix.
-rw-r--r--API.md2
-rw-r--r--README.md2
-rw-r--r--ReiLua_API.lua2
-rw-r--r--examples/resources/lib/matrix.lua33
-rw-r--r--src/text.c2
5 files changed, 19 insertions, 22 deletions
diff --git a/API.md b/API.md
index 09ffda3..61a45f9 100644
--- a/API.md
+++ b/API.md
@@ -6739,7 +6739,7 @@ Load font from file into GPU memory (VRAM)
---
-> font = RL.LoadFontEx( string fileName, int fontSize, int{} codepoints )
+> font = RL.LoadFontEx( string fileName, int fontSize, int{}|nil codepoints )
Load font from file with extended parameters, use NULL for codepoints to load the default character set
diff --git a/README.md b/README.md
index eea77d7..ae20aae 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Reilua means fair in finnish.
## Status
-ReiLua is WIP and some planned raylib functionality is still missing but it already has over 800 functions and should include all functions to make most 2D and 3D games. Current Raylib version 5.0.
+ReiLua is WIP and some planned raylib functionality is still missing but it already has over 900. Current Raylib version 5.0.
Included submodules.
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index 3c076f3..1ee0846 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -3919,7 +3919,7 @@ function RL.LoadFont( fileName ) end
---- Success return Font
---@param fileName string
---@param fontSize integer
----@param codepoints table
+---@param codepoints table|nil
---@return any font
function RL.LoadFontEx( fileName, fontSize, codepoints ) end
diff --git a/examples/resources/lib/matrix.lua b/examples/resources/lib/matrix.lua
index 28d4305..1dc128f 100644
--- a/examples/resources/lib/matrix.lua
+++ b/examples/resources/lib/matrix.lua
@@ -3,23 +3,20 @@ if table.unpack == nil then
table.unpack = unpack
end
-local function deepCopy( orig )
- local copy
+local function copyMatrix( orig )
+ local copy = RL.MatrixIdentity()
- if type( orig ) == "table" then
- copy = {}
+ if orig ~= nil then
+ for y = 1, 4 do
+ for x = 1, 4 do
+ if orig[x][y] ~= nil then
+ copy[x][y] = orig[x][y]
+ end
+ end
+ end
+ end
- for origKey, origValue in next, orig, nil do
- -- If object has clone method, use that.
- copy[ deepCopy( origKey ) ] = deepCopy( origValue )
- end
-
- -- setmetatable( copy, utillib.deepCopy( getmetatable( orig ) ) )
- else -- number, string, boolean, etc.
- copy = orig
- end
-
- return copy
+ return copy
end
local Matrix = {}
@@ -50,17 +47,17 @@ Matrix.meta = {
function Matrix:new( m )
local object = setmetatable( {}, Matrix.meta )
- object.m = deepCopy( m )
+ object.m = copyMatrix( m )
return object
end
function Matrix:set( m )
- self.m = deepCopy( m )
+ self.m = copyMatrix( m )
end
function Matrix:clone()
- return Matrix:new( self )
+ return Matrix:new( self.m )
end
function Matrix:determinant()
diff --git a/src/text.c b/src/text.c
index 0b0a3c3..4d781dd 100644
--- a/src/text.c
+++ b/src/text.c
@@ -211,7 +211,7 @@ int ltextLoadFont( lua_State* L ) {
}
/*
-> font = RL.LoadFontEx( string fileName, int fontSize, int{} codepoints )
+> font = RL.LoadFontEx( string fileName, int fontSize, int{}|nil codepoints )
Load font from file with extended parameters, use NULL for codepoints to load the default character set