当前位置:网站首页>Lua hot update basic grammar
Lua hot update basic grammar
2022-07-03 07:57:00 【qq_ two billion three hundred and eighty-five million seven hun】
1, What is hot update
Hot updates can be done without downloading the client again , Update the content of the game .
2, Why? C# Scripts cannot be updated directly
C# You need to compile before running dll file , This compilation process cannot be completed on mobile platforms
3, What is? AssetBundle
Resource renewal Technology , It is through AssetBundle, We can go through AssetBundle Update game UI, You can also package scripts or other code as resources AssetBundle Then update to the client .
Lua It is a powerful and compact scripting language , Parsing can be run across platforms , And there is no need to compile
4, How to use it Lua Hot update
You can write Lua The parser , Through this parser , You can run the latest Lua Script , Then we write the code that controls the logic of the game Lua Script
5, How to learn hot renewal Technology
1, Study Lua Programming
2, Learn to pass LuaInterface and luanet Conduct Lua and C# Interactive communication
3, Learn to use AssetBundle Update resources
4, Study uLua SimpleFramework
6,Lua What is it
Embedded in the application , Flexible extension and customization for applications ,
Lua There is a simultaneous JIT project , Provides instant compilation on a specific platform .
Luaforwindows
http://luaforwindows.luaforge.net/
( Installable exe file , A whole set of Lua development environment , Yes Lua Interpreter , Reference manual , Examples and libraries , file , And editor )
lua Open under the installation directory SciTE.exe,lua The suffix of the file is .lua, Press down F5 function
7, How to define variables
num= 100
stay Lua Variables defined in are of no type , According to what data is stored , To decide what type
How to add comments
1, Single-line comments -- The comment
2, Multiline comment --[[ Here are the notes ]]--
Lua The types of variables in are as follows :
1,nil Represents empty data , Equate to null
2,boolean Boolean type , Storage true and false
3,string String type , Strings can be expressed in double quotation marks or single quotation marks
4,number Decimal type (Lua There is no integer type in )
5,table Table type
myTable = {34,34,2,342,4}
myTable[3]
We can use type() To get the type of a variable
matters needing attention
All variables defined by default are global , To define a local variable, you need to add a local;
Local variables declared in a code block , At the end of contemporary code block operation , This variable will be released ;
temp= 34
local var = 345
if Usage of sentences
local hp = 40
if hp<=0 then
print("role is die")
elseif hp>=50 then
print("role is good")
else
print("role is bad")
endLoop structure while loop
index = 1
while index<=100 do
print(index)
index=index+1
endLoop structure repeat loop
repeat
print(index)
index=index+1
until index>100for Loop structure
sum = 0
for index = 1,100 do
sum=sum+index
end
print(sum)function ( Method )
function Plus(num1,num2)
return num1+num2
end
res = Plus(34,45)
print(res)
Mathematical operation function
math.abs -- Take the absolute value
math.cos -- Take trigonometric function
math.max
math.maxinteger
math.min
math.random
math.sin
math.sqrt
math.tan
String processing related functions
string.byte
string.char
string.find
sting.format
string.lower
string.sub
string.upper
.. String addition
tostring() Convert a number into a string
tonumber() Convert a string into a number
table surface
stay Lua Medium table similar C# Dictionary in , It's really just a key-value Data structure of key value pair .
1,table The creation of
myTable = {}
Use after the table name {} assignment , Represents an empty table
2,table Assignment
myTable[3]=34 The assignment method when the key is a number
myTable["name"]="taikr" When the key is a string assignment
myTable.name = "siki" When the key is a string assignment
3,table The interview of
myTable[3] When the key is a number , There is only one way to access
myTable.name When the key is a string, there are two ways to access
myTable["name"]
Table related functions
1.table.concat, Connect all the data in the table into a string
2,table.insert, Insert a data into the specified location
3,table.move, mobile data
4,table.pack, Pack it into a watch
5,table.remove, Remove the data from the specified location
6,table.sort, Sort
7,table.unpack, Returns an array , An array of specified ranges
--[[
myTable={}
myTable[1]=34
myTable[3]="sdf"
myTable["name"] = "taikr"
myTable.name = "siki"
print(myTable[1] ,myTable.name,myTable["name"] )
myTable = {name="taikr",age=18,isMan = false}
myTable.school = " Tyco online "
print(myTable.isMan,myTable.school )
]]--
--scores = {34,56,123,6734,23}
--print( scores[1] )
--for index=1,table.getn(scores) do
--print( scores[index] )
--end
--[[
myTable = {name="taikr",age=18,isMan = false}
for index,value in pairs(myTable) do
print(index,value)
end
]]--
myTable = {name="taikr",age=18,isMan = false}
scores = {34,56,123,6734,23}
table.insert( myTable,2,2 ) -- myTable[2]=2
table.remove(scores,3)
table.sort(scores)
print( table.concat(scores))
边栏推荐
- VMware virtual machine configuration static IP
- Research shows that breast cancer cells are more likely to enter the blood when patients sleep
- PHP common sorting algorithm
- 璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型
- Technical dry goods | some thoughts on the future of AI architecture
- An intern's journey to cnosdb
- YOLO系列 --- xml2txt脚本
- P2704 [NOI2001] 炮兵阵地(状压dp)
- Go language foundation ----- 09 ----- exception handling (error, panic, recover)
- go语言-循环语句
猜你喜欢

WPF:解决MaterialDesign:DialogHost 无法关闭问题

Redis批量启停脚本

Viz artist advanced script video tutorial -- stringmap use and vertex operation

Go language foundation ----- 08 ----- interface

Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does

Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)

Unity XR实现交互(抓取,移动旋转,传送,射击)-Pico

How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03

Go language foundation ----- 13 ----- file

STM32F103 SPI (pit Diary)
随机推荐
[cocos creator] Click the button to switch the interface
tslib库的移植
Worldview satellite remote sensing image data / meter resolution remote sensing image
华为交换机基础配置(telnet/ssh登录)
Wechat applet taro learning record
[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)
Uniapp learning records
Huawei switch console password reset, device initialization, default password
【cocos creator】获取资源uuid
链式长取值
Redis配置文件
华为S5700交换机初始化和配置telnet,ssh用户方法
Technical dry goods | thinking about the unification of dynamic and static diagrams of AI framework
Go language foundation ----- 08 ----- interface
WPF:解决MaterialDesign:DialogHost 无法关闭问题
vcs import src < ros2. Repos failed
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
C language learning notes (mind map)
How does yarn link help developers debug NPM packages?
Register keyword