当前位置:网站首页>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")
end
Loop structure while loop
index = 1
while index<=100 do
print(index)
index=index+1
end
Loop structure repeat loop
repeat
print(index)
index=index+1
until index>100
for 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))
边栏推荐
- P2622 关灯问题II(状态压缩 搜索)
- Go language foundation ------ 14 ------ gotest
- [at] abc 258G - Triangle 三元组可达-暴力
- 华为交换机配置ssh登录远程管理交换机
- PDO and SDO concepts
- Viz artist advanced script video tutorial -- stringmap use and vertex operation
- HDMI2.1与HDMI2.0的区别以及转换PD信号。
- PHP wechat red packet grabbing algorithm
- 微软安全响应中心
- s7700设备如何清除console密码
猜你喜欢
Pat class a 1031 Hello world for u
Technical dry goods | Bert model for the migration of mindspore NLP model - text matching task (2): training and evaluation
PostGIS space function
Redis批量启停脚本
Go language foundation ------ 14 ------ gotest
【cocos creator】点击按钮切换界面
Go language foundation ----- 16 ----- goroutine, GPM model
What is a data type? What is the use of data types?
freetype库的移植
Zohocrm deluge function application time verification
随机推荐
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!
Redis查看客户端连接
Technology dry goods | Roberta of the migration of mindspore NLP model - emotion analysis task
idea取消引用显示效果
Huawei s5700 switch initialization and configuration SSH and telnet remote login methods
My touch screen production "brief history" 2
How does yarn link help developers debug NPM packages?
Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
Generate video using clipout in viz engine
Quality blog——
LwIP learning socket (API)
OSPF protocol summary
Go language foundation ----- 18 ----- collaboration security, mutex lock, read-write lock, anonymous lock, sync Once
Uniapp learning records
Zohocrm deluge function application time verification
优质博客——
Install cross compiler arm none liunx gnueabihf
Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
haproxy+keepalived搭建01