Files
DNF_DEV_SQR/internalInterfaceDoc/文档注释须知.nut
2025-10-17 23:37:16 +08:00

84 lines
1.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//Type Squirrel的类型名称与squirrel一致
//integer->整数
//float->浮点数
//array或者[]代表任意类型数组
//table->{}
//string->字符串
//boolean->布尔值
//文档注释中指定类型的数组应该这么做
/**
* Description placeholder
* @param {array(integer)} args
*/
function arrayExample(args) {}
//任意类型的数组应该这么做
/**
*
* @function
* @param {array} args
* @returns {void} //如果不写@returns 代表返回null{void}或{*}代表返回any
*/
function anyArrayExample(args) {}
//以下是其他类型的文档注释示例
/**
*
* @function
* @param {integer} args
* @returns {void}
*/
function intExample(args) {}
/**
*
* @function
* @param {float} args
* @returns {void}
*/
function floatExample(args) {}
/**
* Description placeholder
* @param {string} args
*/
function stringExample(args) {}
/**
*
* @function
* @param {boolean} args
* @returns {void}
*/
function boolExample(args) {}
/**
*
* @function
* @param {table} args
* @returns {void}
*/
function tableExample(args) {}
//以下是内联提示与hover
local a = 1;
local b = "1";
local c = 1.1;
local d = false;
local t = {};
local arr = [];
local intArr = [1];
local floatArr = [1.1];
local strArr = ["str"];
local anyArr = [];
//以下是二元表达式类型推断
local x = 1 + 1;
local x1 = 1 / 1;
local x2 = 1 * 0.1;
local x3 = (1 + 1).tofloat() + (1 / 2).tofloat();