complex:__newindex
code:Lua
モジュール
引数
table:_
変数 型 概要
2 idx number / string 添字(数値/文字列)
3 value number 代入する値
概要
複素数クラスの添字代入を定義したメタメソッド。
テーブルのように、添字を利用して任意の値を代入することができる。
実部にアクセスする際の添字: 1 "r" "real"
虚部にアクセスする際の添字: 2 "i" "imag"
例
code:lua
require("textmodule")
c = textmodule.complex.new(0, 0)
debug_print(tostring(c)) -- "(0,0)"
debug_print(tostring(c)) -- "(3,0)"
debug_print(tostring(c)) -- "(3,2)"