Ask God friend to help younger brother to generate a 64 bit Lua static library liblua.a
Yes, it's 64
Thanks a million!
Little brother can't make 64 liblua.a
Find a 64 bit Lua static library liblua.a
Re: Find a 64 bit Lua static library liblua.a
do you have msys2 installed?
if so all you need to do is launch the 64-bit shell, cd to the lua-5.3.4 directory and: make mingw
I don't have other mingw versions installed, so this is all I can help.
you can find msys2 at http://www.msys2.org
if so all you need to do is launch the 64-bit shell, cd to the lua-5.3.4 directory and: make mingw
I don't have other mingw versions installed, so this is all I can help.
you can find msys2 at http://www.msys2.org
Re: Find a 64 bit Lua static library liblua.a
Lua provides compiled binaries for different OS's (for WIN64, static, see below)
64 bit static Lib (for Windows), download
There is no need, to build it oneself, from source ...
Current name: liblua53.a (version: 5.3.4)
64 bit static Lib (for Windows), download
There is no need, to build it oneself, from source ...
Current name: liblua53.a (version: 5.3.4)
Re: Find a 64 bit Lua static library liblua.a
Thank you very much for your help. Thanks again for the big brotherMrSwiss wrote:Lua provides compiled binaries for different OS's (for WIN64, static, see below)
64 bit static Lib (for Windows), download
There is no need, to build it oneself, from source ...
Current name: liblua53.a (version: 5.3.4)
Re: Find a 64 bit Lua static library liblua.a
You could test your Lua library with this little curve sketcher.
Some roots are written to the console.
Type in an expression at the prompt.
Then set a range on the x axis e.g, -9,9
It's maybe a bit buggy, I just pieced it together.
The available functions are Standard Lua(seen in the code)
Some roots are written to the console.
Type in an expression at the prompt.
Then set a range on the x axis e.g, -9,9
It's maybe a bit buggy, I just pieced it together.
The available functions are Standard Lua(seen in the code)
Code: Select all
#include "crt.bi"
#Include Once "Lua/lauxlib.bi"
#Include Once "Lua/lualib.bi"
Dim Lua As lua_State Ptr = luaL_newstate
dim shared as long luaerror
luaL_openlibs(Lua)
'available math functions
dim as string _d(1 to 29)= {"abs","acos","asin","atan","atan2","ceil","cos","cosh","deg","exp","floor","fmod","frexp", _
"huge","ldexp","log","max","min","modf","pi","pow","rad","random","randomseed","sin","sinh", _
"sqrt","tan","tanh"}
dim shared as string _d_(1 to ubound(_d))
for n as long=1 to ubound(_d_)
_d_(n)=_d(n)
next
'find and replace
Function SAR(s0 As String,s1 As String,s2 As String) As String
Dim s As String=s0
var position=Instr(s,s1)
While position>0
s=Mid(s,1,position-1) & s2 & Mid(s,position+Len(s1))
position=Instr(position+Len(s2),s,s1)
Wend
SAR=s
End Function
sub _format(s as string) 'put the math. before a function if needed.
s=lcase(s)
dim as string tmp=s
for n as long=1 to ubound(_d_)
if instr(s,_d_(n)) then s=SAR(s,_d_(n),"math." + ucase(_d_(n)))
next
s=lcase(s)
end sub
Function Evaluate(fname As String,ByVal Expression As String,StringVariable As String,DoubleVariable As Double,ByRef lua As lua_state Ptr) As Double
static func As String
static as string nf
If len(func)=0 or nf<>expression or len(nf)=0 Then 'setup and compile function
nf=expression
_format(Expression)
func = "function " + fname +"("+StringVariable+")" +Chr(13)+Chr(10) _
+ " return " +Expression + Chr(13)+Chr(10) _
+ "end"
' Print func
If luaL_dostring(Lua,func) Then
print "LUA INTERNAL ERROR"
PRINT "Error: " & *lua_tostring(Lua, -1),__LINE__
luaerror=1
End If
End If
lua_getglobal(Lua, fname)
lua_pushnumber(Lua, DoubleVariable)
IF lua_pcall(Lua, 1, 1, 0) Then
print "LUA INTERNAL ERROR"
Print "Error: " & *lua_tostring(Lua, -1),__LINE__
luaerror=1
End If
Evaluate = lua_tonumber(Lua, -1)
lua_pop(Lua, 1)
End Function
function eval(byval e as string,x as double,byref lua as lua_State Ptr ) as double
static as string nf
static as string title
static as integer i
if nf<>e then title="f"+str(i):i+=1
eval= evaluate(title,e,"x",x,lua)
nf=e
end function
'=================== END OF PARSER =======================
'approx roots
sub bisectlast(byval f as string,min as double,max as double,byref O as double,byref lua as lua_State Ptr,j as double)
dim as string f2=f
dim as double last,st=(max-min)/50000
for n as double=min to max step st
var v=eval(f2,n,lua)
if sgn(v)<>sgn(last) then puts str( (n+(n+st))/2 ):O=n+2*j:exit sub
last=v
next
end sub
sub bisect(byval f as string,min as double,max as double,byref O as double,byref lua as lua_State Ptr,j as double)
dim as string f2=f
dim as double last,st=(max-min)/50000
for n as double=min to max step st
var v=eval(f2,n,lua)
if sgn(v)<>sgn(last) and n>min then bisectlast(f,n-st,n,O,lua,j)
last=v
next
end sub
sub roots(byval f as string,min as double,max as double,c as string,byref lua as lua_State Ptr)
puts (c)
dim as string f2=f
dim as double last,O,st=(max-min)/50000
for n as double=min to max step st
var v=eval(f2,n,lua)
if sgn(v)<>sgn(last) and n>min then bisect(f,n-st,n,O,lua,st):n=O
last=v
next
end sub
'===============================================================================
Dim As String e,g,laste,copy
Dim As Double v
Dim As Double minx,maxx,miny,maxy,stp
dim as string sminx,smaxx
Screen 20
Do
start:
luaerror=0
puts("Roots")
Cls
miny=1e20
maxy=-1e20
locate 2,1
print "Example of a function in x sin(x)*cos(x)"
if len(laste) then
Locate 5,8
print "Previous function ";laste
print "Enter <enter> to use previous function"
end if
locate 10
Input "Enter a math function in x ",e
if len(e) then copy=e
if len(e)=0 then e=laste
e=lcase(e)
print "Chosen function ";copy
lbl:
Locate ,10
Input "Enter x axis range e.g. -4,7 ",sminx,smaxx
minx=val(sminx)
maxx=val(smaxx)
if minx>=maxx then print "Please Redo!":goto lbl
stp=(maxx-minx)/1000
dim as double t=timer
For n As Single=minx To maxx Step stp
v= eval(e,n,lua)
if luaerror then print "Start again -- ERROR, press a key ":sleep:goto start
If miny>v Then miny=v
If maxy<v Then maxy=v
Next
Window(minx,miny)-(maxx,maxy)
For n As Single=minx To maxx Step stp
v=eval(e,n,lua)
If n=minx Then Pset(n,v) Else Line -(n,v)
Next
'axis
If minx<0 And maxx>0 Then Line(0,maxy)-(0,miny),4
If miny<0 And maxy>0 Then Line(minx,0)-(maxx,0),4
Window
Draw String(500,0),Str(maxy)
Draw String(500,768-16),Str(miny)
Draw String(0,768\2),Str(minx)
Draw String(1024-8*Len(Str(maxx)),768\2),Str(maxx)
roots(e,minx,maxx,copy,lua)
laste=copy
print "Press <spacebar> to continue"
print "Press <esc> to end"
Sleep
If Inkey=Chr(27) Then Exit Do
Loop
End