Hellow again... I don't want to be too demanding but..........
I want you to make wrong argument detector like in default Lua:
For example if we load function into string.sub we will got next output:
> string.sub(print,1)
stdin:1: bad argument #1 to 'sub' (string expected, got function)
stack traceback:
[C]: in function 'sub'
stdin:1: in main chunk
[C]: in ?
But if I load int value into my Godot func blit(text :String, textColor, backColor): like that: blit(1,print,1) -> it will simply refuse to run and not even sent an error or message like "hey! you just load wrong arg to func".
Of course I can create that thing my self and I have done it allready (see the picture) but blit function is one of the most called so I MUST optimise it VERY WELL becase it's original is written in C++.
I have done some perfomance checks (simple fractal calc function) and run fract(2000) for both Godot and Lua 300 times to calculate mid value:
So there are results:
Results. Debug version:
extends Node
func fact(num :int) -> int:
var rez := 1
for i in num:
rez = rez*(i+1)
return rez
func test() -> int:
var st = Time.get_ticks_msec()
for i in 2000:
fact(i)
var nd = Time.get_ticks_msec()
return nd-st
func _init():
print("LuaAPI.test:")
var a = LuaAPI.new()
a.bind_libraries(["base","os"])
a.push_variant("func",func():push_error("Error"))
var rez = a.do_string("""
function fact(num)
local rez = 1
for i=1,num do
rez = rez*i
end
return rez
end
function test()
local st = os.clock()
for i=0,2000 do
fact(i)
end
local nd = os.clock()
return nd-st
end
local data = 0
for i=1,300 do
data = data + test()
end
print("Lua factor: ", data/300) --mid value
""")
var data = 0
for i in 300:
data = data + test()
print("Godot: ",data/300.0/100.0)
So as you can see GDscript is INCREDIBLY SLOW comparring to Lua, so a single argument type check can ruin evrything.
blit is important text function used by Pine3D and other CraftOS programs to render 2D/3D stuff (yea I am talking about Game that run on CraftOS inside another Game).
And it need to be called ~19*20 times per second to achive ~20 FPS inside CraftOS Games...
So it's very important for me to have that bad argument detector for Godot strict typed functions...
If you decide to add that feature (then thank you very much), you don't need to do that check for all classes that exist in Godot.
A simple check for Lua only types {nil,number,string, ...} should be enought...
Thank you for your attention...
Hellow again... I don't want to be too demanding but.......... I want you to make wrong argument detector like in default Lua: For example if we load
function
intostring.sub
we will got next output:But if I load
int
value into my Godotfunc blit(text :String, textColor, backColor):
like that:blit(1,print,1)
-> it will simply refuse to run and not even sent an error or message like "hey! you just load wrong arg to func
". Of course I can create that thing my self and I have done it allready (see the picture) butblit
function is one of the most called so I MUST optimise it VERY WELL becase it's original is written inC++
. I have done some perfomance checks (simple fractal calc function) and run fract(2000) for both Godot and Lua 300 times to calculate mid value: So there are results: Results. Debug version:Release version:
Test source code:
So as you can see GDscript is INCREDIBLY SLOW comparring to Lua, so a single argument type check can ruin evrything.
blit
is important text function used by Pine3D and other CraftOS programs to render 2D/3D stuff (yea I am talking about Game that run on CraftOS inside another Game). And it need to be called ~19*20 times per second to achive ~20 FPS inside CraftOS Games... So it's very important for me to have thatbad argument
detector for Godot strict typed functions...If you decide to add that feature (then thank you very much), you don't need to do that check for all classes that exist in Godot. A simple check for Lua only types
{nil,number,string, ...}
should be enought... Thank you for your attention...