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