1.luadec软件ä¸è½½ï¼
2.luaä¸çexeå¨åªï¼
3.LuaJIT源码分析(一)搭建调试环境
4.怎么打开lua
5.Lua5.4 源码剖析——杂谈 之 如何调试Lua源码
6.Lua性能优化(三):ELuaProfiler开源
luadec软件ä¸è½½ï¼
对äº*.luaæ件,码网微信支付商城源码éè¦ç¨ä»ä¹è½¯ä»¶ç¨åºæå¼?
1ãå¦ææ¯æ¥ççè¯ï¼å¯ä»¥å®è£ ä¸äºç¬¬ä¸æ¹çè®°äºæ¬è½¯ä»¶ï¼ç¶åç¨ä»ä»¬æå¼luaæ件è¿è¡æ¥çãæè ç´æ¥ä¿®æ¹åç¼å为ææ¬ææ¡£æ ¼å¼ï¼ä½¿ç¨è®°äºæ¬æå¼ã
2ã以å°ç±³max2为ä¾ï¼å®åææºæå¼luaæ件æ¹æ³å¦ä¸ï¼é¦å å¯ä»¥å°å®ç½ä¸è½½ä¸ä¸ªGGï¼ä¸è½½ä¹åè¯è¨è®¾ç½®ä¸å³å¯ï¼è®°ä½è¿éä¸å®è¦æ¯å¨å®ç½ä¸è½½çï¼ä¸è½½ä¹åä¼å®è£ 两个çæ¬ï¼ä¸ä¸ªæ¯ç¡¬ä»¶å éï¼ä¸ä¸ªæ¯è½¯ä»¶å éï¼ä¸¤ä¸ªé½å¯ä»¥ä½¿ç¨ã
3ãé¦å æ£æ¥èªå·±Windowä¸æ没æå®è£ Luaï¼å¦æ没æçè¯/files/wf/lua.txt),æ¯ä¸ªææ¬æ件(lua.txt)ãæå¼UltraEditå®è£ ç®å½ä¸çwordfile.txtï¼ælua.txtæ件ä¸çå 容æ·è´ç²è´´å°wordfile.txtçæ«å°¾ï¼åçï¼OKï¼äºæ¯UltraEditè¯æ³é«äº®é¡¹å¤åºLuaä¸é¡¹ï¼å¯ä»¥éæ©ä½¿ç¨äºãå ¶ä»è¯è¨çè¯æ³é«äº®æ¯æä¸æ¤ç±»ä¼¼ã
ä½ä½ å¦ææ¯Javaå¼åè ï¼åºè¯¥é½ç¨è¿Eclipseå§ï¼å¯å¦å¨Eclipseä¸ç´æ¥å°±åLuaèæ¬å¢ï¼çæ¡æ¯å¯ä»¥çï¼
è¿å½ç¶æ¯Eclipseç强大çæ件管çåè½å¦ï¼ä½ å¯ä»¥å»ä¸è½½luaeclipseæ件æ¥ä½¿ä½ çEclipseæ¥æç¼åLuaèæ¬çè½åï¼æ¢å¯ä»¥é«äº®æ¾ç¤ºä½ çèæ¬ï¼æ¯ä¸æ¯å¾ç½å¢ï¼ï¼ä½ å¯ä»¥å¨è¿éä¸è½½:.br/luaeclipse/
ä¸è½½åå®è£ åï¼ä½ çEclipseå°±å¯ä»¥å»ºç«åç¼åLuaèæ¬äºï¼æ³¨æ设置ä¸ä¸é¦é项ä¸å ³äºLUAçå±æ§(Eclipseå®è£ æ件就ä¸ç¨æ说äºå§ï¼ï¼ï¼ï¼)
好äºï¼ç°å¨ä¸åé½åå¤å¥½äºï¼è®©æ们æ¥ä¸ä¸ªHelloWorldå§ï¼
é¦å å¨Eclipseå 建ç«ä¸ä¸ªTestLua项ç®ï¼ç¶åç¼åå¦ä¸ç¨åºï¼
import org.keplerproject.luajava.*;
public class Hello
{
public static void main(String[] args)
{
LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
System.out.println("è¿éæ¯Javaç¨åºè°ç¨Luaèæ¬");
// å è½½èæ¬hello.lua,并æ§è¡
L.LdoFile("res/hello.lua");
}
}
好äºï¼ç¨åºåå®äºï¼å½ç¶æ¯ä¿å为Hello.javaå¯ï¼æ³¨æï¼è¿æ¯Java代ç ï¼è¿æ¯Java代ç è°ç¨äºä¸ä¸ªå«hello.luaçèæ¬ï¼ä¸è¾¹æ¯è¿ä¸ªèæ¬æ件çå 容(ä½ å¯ä»¥ç´æ¥æä»ä»¬å¤å¶å°ä½ çhello.luaæ件ä¸)ï¼
================================================================
--åºæ¬æ¹æ³
print("æ¨ç°å¨ä½¿ç¨çæ¯LUAèæ¬è¯è¨")
print("让æ们ä¸èµ·æ¥æåå®çå¥å¦å§!\n")
--ç¹ç¹1,èµå¼
a={ 1,2}
b=a
print(a==b, a~=b) --è¾åº true, false
a={ 1,2}
b={ 1,2}
print(a==b, a~=b) --è¾åº false, true
--ç¹ç¹2,交æ¢
a,b=1,2
a,b=b,a
print(a)
print(b)
print("è¿æ¥".."å符串"..2^3)
print(type(2))
--while循ç¯
i=0
print("while循ç¯ä¾å")
while i<5
do
print(i);
i=i+1
end
--repeat循ç¯
i=0
print("repeat循ç¯ä¾å")
repeat
print(i)
i=i+1
until i>=5
--for循ç¯
print("for循ç¯ä¾å")
for i=0,5,1
do
print(i)
end
T1={ }
T1[1] =
print(T1[1])
function fun(a,b,...)
print(a)
print(b)
print(arg[1])
print(arg[2])
print(arg[3])
return
end
a,b=2,3
fun(a,b,,,)
========================================================
好äºï¼ä¸è¾¹çèæ¬å¦æä½ ä¸æä»ä¹ææä¹æ²¡å ³ç³»ï¼ç´æ¥è¿è¡ä¸ä¸å§
ä½ å¯ä»¥æ§è¡ç¼è¯æ§è¡é£ä¸ªHello.javaç¨åºå°±å¯ä»¥äºï¼å°±ä¼çå°å¦ä¸çè¾åºç»æï¼
========================================================
è¿éæ¯Javaç¨åºè°ç¨Luaèæ¬
æ¨ç°å¨ä½¿ç¨çæ¯LUAèæ¬è¯è¨
让æ们ä¸èµ·æ¥æåå®çå¥å¦å§!
true false
false true
2
1
è¿æ¥å符串8
number
while循ç¯ä¾å
0
1
2
3
4
repeat循ç¯ä¾å
0
1
2
3
4
for循ç¯ä¾å
0
1
2
3
4
5
2
3
==========================================================
ææ ·ï¼æ¯ä¸æ¯å¾ç½å¢ï¼è§å¾æ²¡ææï¼å¥½ï¼å¨æ¥ä¸æ®µèæ¬å§ï¼
frame = luajava.newInstance("java.awt.Frame", "Lua Java Console")
console = luajava.newInstance("java.awt.TextArea")
buttons_pn = luajava.newInstance("java.awt.Panel")
execute_bt = luajava.newInstance("java.awt.Button", "Execute")
clear_bt = luajava.newInstance("java.awt.Button", "Clear")
exit_bt = luajava.newInstance("java.awt.Button", "Exit")
frame:setSize(,)
buttons_pn:add(execute_bt)
buttons_pn:add(clear_bt)
buttons_pn:add(exit_bt)
BorderLayout = luajava.bindClass("java.awt.BorderLayout")
frame:add(BorderLayout.NORTH, console)
frame:add(BorderLayout.SOUTH, buttons_pn)
frame:pack()
frame:show()
--
-- Listeners
--
execute_cb = {
actionPerformed = function(ev)
print("execute")
pcall(loadstring(console:getText()))
end
}
jproxy = luajava.createProxy("java.awt.event.ActionListener",execute_cb)
execute_bt:addActionListener(jproxy)
clear_cb = { actionPerformed= function (ev)
print("clear");
console:setText("");
end
}
jproxy = luajava.createProxy("java.awt.event.ActionListener" ,clear_cb)
clear_bt:addActionListener(jproxy)
exit_cb = { actionPerformed=function (ev)
print("exit")
frame:setVisible(false)
frame:dispose()
end
}
jproxyb = luajava.createProxy("java.awt.event.ActionListener" ,exit_cb)
exit_bt:addActionListener(jproxyb)
close_cb = { }
function close_cb.windowClosing(ev)
print("close")
frame:setVisible(false)
frame:dispose()
end
function close_cb.windowActivated(ev)
print("act")
end
jproxy = luajava.createProxy("java.awt.event.WindowListener", close_cb)
frame:addWindowListener(jproxy)
è¿æ®µèæ¬è¿è¡åä½ å°ä¼é常æ³è¿ä¸æ¥äºè§£LUAç奥å¦ï¼è³äºä»ä¹æå°±ä¸è¯´äºï¼ä½ 们èªå·±è¿è¡ççå§ãããååï¼å°±åå°è¿éäºï¼æå»ä¸ä¸WCãããã